use of org.jetbrains.plugins.groovy.lang.psi.stubs.GrFileStub in project intellij-community by JetBrains.
the class GrStubFileElementType method deserialize.
@NotNull
@Override
public GrFileStub deserialize(@NotNull final StubInputStream dataStream, final StubElement parentStub) throws IOException {
StringRef name = dataStream.readName();
boolean isScript = dataStream.readBoolean();
return new GrFileStub(name, isScript, GrStubUtils.readStringArray(dataStream));
}
use of org.jetbrains.plugins.groovy.lang.psi.stubs.GrFileStub in project intellij-community by JetBrains.
the class GroovyFileImpl method isScript.
@Override
public boolean isScript() {
final StubElement stub = getStub();
if (stub instanceof GrFileStub) {
return ((GrFileStub) stub).isScript();
}
Boolean isScript = myScript;
if (isScript == null) {
isScript = checkIsScript();
myScript = isScript;
}
return isScript;
}
use of org.jetbrains.plugins.groovy.lang.psi.stubs.GrFileStub in project intellij-community by JetBrains.
the class GrStubFileElementType method getBuilder.
@Override
public StubBuilder getBuilder() {
return new DefaultStubBuilder() {
@NotNull
@Override
protected StubElement createStubForFile(@NotNull final PsiFile file) {
if (file instanceof GroovyFile) {
return new GrFileStub((GroovyFile) file);
}
return super.createStubForFile(file);
}
@Override
public boolean skipChildProcessingWhenBuildingStubs(@NotNull ASTNode parent, @NotNull ASTNode node) {
IElementType childType = node.getElementType();
IElementType parentType = parent.getElementType();
if (childType == GroovyElementTypes.PARAMETER && parentType != GroovyElementTypes.PARAMETERS_LIST) {
return true;
}
if (childType == GroovyElementTypes.PARAMETERS_LIST && !(parent.getPsi() instanceof GrMethod)) {
return true;
}
if (childType == GroovyElementTypes.MODIFIERS) {
if (parentType == GroovyElementTypes.CLASS_INITIALIZER) {
return true;
}
if (parentType == GroovyElementTypes.VARIABLE_DEFINITION && !GroovyElementTypes.VARIABLE_DEFINITION.shouldCreateStub(parent)) {
return true;
}
}
return false;
}
};
}
Aggregations