Add PsiJetFunctionStub#hasBlockBody()
This commit is contained in:
@@ -20,17 +20,12 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.psi.JetNamedFunction;
|
||||
|
||||
public interface PsiJetFunctionStub extends PsiJetStubWithFqName<JetNamedFunction> {
|
||||
/**
|
||||
* Is function defined in directly in package.
|
||||
* @return
|
||||
*/
|
||||
boolean isTopLevel();
|
||||
|
||||
/**
|
||||
* Does function extends some type.
|
||||
*/
|
||||
boolean isExtension();
|
||||
|
||||
boolean hasBlockBody();
|
||||
|
||||
@NotNull
|
||||
String[] getAnnotations();
|
||||
}
|
||||
|
||||
+5
-2
@@ -55,7 +55,8 @@ public class JetFunctionElementType extends JetStubElementType<PsiJetFunctionStu
|
||||
boolean isTopLevel = psi.getParent() instanceof JetFile;
|
||||
boolean isExtension = psi.getReceiverTypeRef() != null;
|
||||
FqName fqName = ResolveSessionUtils.safeFqNameForLazyResolve(psi);
|
||||
return new PsiJetFunctionStubImpl(parentStub, psi.getName(), isTopLevel, fqName, isExtension);
|
||||
boolean hasBlockBody = psi.hasBlockBody();
|
||||
return new PsiJetFunctionStubImpl(parentStub, psi.getName(), isTopLevel, fqName, isExtension, hasBlockBody);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,6 +68,7 @@ public class JetFunctionElementType extends JetStubElementType<PsiJetFunctionStu
|
||||
dataStream.writeName(fqName != null ? fqName.asString() : null);
|
||||
|
||||
dataStream.writeBoolean(stub.isExtension());
|
||||
dataStream.writeBoolean(stub.hasBlockBody());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -79,8 +81,9 @@ public class JetFunctionElementType extends JetStubElementType<PsiJetFunctionStu
|
||||
FqName fqName = fqNameAsString != null ? new FqName(fqNameAsString.toString()) : null;
|
||||
|
||||
boolean isExtension = dataStream.readBoolean();
|
||||
boolean hasBlockBody = dataStream.readBoolean();
|
||||
|
||||
return new PsiJetFunctionStubImpl(parentStub, name, isTopLevel, fqName, isExtension);
|
||||
return new PsiJetFunctionStubImpl(parentStub, name, isTopLevel, fqName, isExtension, hasBlockBody);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+16
-3
@@ -33,15 +33,17 @@ public class PsiJetFunctionStubImpl extends StubBase<JetNamedFunction> implement
|
||||
private final boolean isTopLevel;
|
||||
private final boolean isExtension;
|
||||
private final FqName fqName;
|
||||
private final boolean hasBlockBody;
|
||||
|
||||
public PsiJetFunctionStubImpl(
|
||||
@NotNull StubElement parent,
|
||||
@Nullable String name,
|
||||
boolean isTopLevel,
|
||||
@Nullable FqName fqName,
|
||||
boolean isExtension
|
||||
boolean isExtension,
|
||||
boolean hasBlockBody
|
||||
) {
|
||||
this(parent, StringRef.fromString(name), isTopLevel, fqName, isExtension);
|
||||
this(parent, StringRef.fromString(name), isTopLevel, fqName, isExtension, hasBlockBody);
|
||||
}
|
||||
|
||||
public PsiJetFunctionStubImpl(
|
||||
@@ -49,7 +51,8 @@ public class PsiJetFunctionStubImpl extends StubBase<JetNamedFunction> implement
|
||||
@Nullable StringRef nameRef,
|
||||
boolean isTopLevel,
|
||||
@Nullable FqName fqName,
|
||||
boolean isExtension
|
||||
boolean isExtension,
|
||||
boolean hasBlockBody
|
||||
) {
|
||||
super(parent, JetStubElementTypes.FUNCTION);
|
||||
|
||||
@@ -61,6 +64,7 @@ public class PsiJetFunctionStubImpl extends StubBase<JetNamedFunction> implement
|
||||
this.fqName = fqName;
|
||||
this.isTopLevel = isTopLevel;
|
||||
this.isExtension = isExtension;
|
||||
this.hasBlockBody = hasBlockBody;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -78,6 +82,11 @@ public class PsiJetFunctionStubImpl extends StubBase<JetNamedFunction> implement
|
||||
return isExtension;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasBlockBody() {
|
||||
return hasBlockBody;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String[] getAnnotations() {
|
||||
@@ -99,6 +108,10 @@ public class PsiJetFunctionStubImpl extends StubBase<JetNamedFunction> implement
|
||||
builder.append("ext ");
|
||||
}
|
||||
|
||||
if (!hasBlockBody) {
|
||||
builder.append("no block body ");
|
||||
}
|
||||
|
||||
builder.append("name=").append(getName());
|
||||
|
||||
builder.append("]");
|
||||
|
||||
Reference in New Issue
Block a user