use of com.intellij.lang.LighterASTNode in project intellij-community by JetBrains.
the class JavaModifierListElementType method shouldCreateStub.
@Override
public boolean shouldCreateStub(final LighterAST tree, final LighterASTNode node, final StubElement parentStub) {
final LighterASTNode parent = tree.getParent(node);
final IElementType parentType = parent != null ? parent.getTokenType() : null;
return shouldCreateStub(parentType);
}
use of com.intellij.lang.LighterASTNode in project intellij-community by JetBrains.
the class FileLocalResolver method getShortClassTypeName.
/**
* Determine the type name of the given variable. Can be used to later iterate over all classes with this name for lightweight checks
* before loading AST and fully resolving the type.
* @param var Variable node
* @return the short name of the class corresponding to the type of the variable, or null if the variable is not of class type or
* the type is generic
*/
@Nullable
public String getShortClassTypeName(@NotNull LighterASTNode var) {
LighterASTNode typeRef = LightTreeUtil.firstChildOfType(myTree, LightTreeUtil.firstChildOfType(myTree, var, TYPE), JAVA_CODE_REFERENCE);
String refName = JavaLightTreeUtil.getNameIdentifierText(myTree, typeRef);
if (refName == null)
return null;
if (LightTreeUtil.firstChildOfType(myTree, typeRef, JAVA_CODE_REFERENCE) != null)
return refName;
if (isTypeParameter(refName, var))
return null;
return refName;
}
use of com.intellij.lang.LighterASTNode in project intellij-community by JetBrains.
the class JavaLightStubBuilder method createStubForFile.
@NotNull
@Override
protected StubElement createStubForFile(@NotNull PsiFile file, @NotNull LighterAST tree) {
if (!(file instanceof PsiJavaFile)) {
return super.createStubForFile(file, tree);
}
String refText = "";
LighterASTNode pkg = LightTreeUtil.firstChildOfType(tree, tree.getRoot(), JavaElementType.PACKAGE_STATEMENT);
if (pkg != null) {
LighterASTNode ref = LightTreeUtil.firstChildOfType(tree, pkg, JavaElementType.JAVA_CODE_REFERENCE);
if (ref != null) {
refText = JavaSourceUtil.getReferenceText(tree, ref);
}
}
return new PsiJavaFileStubImpl((PsiJavaFile) file, refText, null, false);
}
use of com.intellij.lang.LighterASTNode in project intellij-community by JetBrains.
the class JavaLightTreeUtil method getArgList.
@Nullable
@Contract("_,null->null")
public static List<LighterASTNode> getArgList(@NotNull LighterAST tree, @Nullable LighterASTNode call) {
LighterASTNode anonClass = LightTreeUtil.firstChildOfType(tree, call, ANONYMOUS_CLASS);
LighterASTNode exprList = LightTreeUtil.firstChildOfType(tree, anonClass != null ? anonClass : call, EXPRESSION_LIST);
return exprList == null ? null : getExpressionChildren(tree, exprList);
}
use of com.intellij.lang.LighterASTNode in project intellij-community by JetBrains.
the class JavaPackageAccessibilityStatementElementType method createStub.
@Override
public PsiPackageAccessibilityStatementStub createStub(LighterAST tree, LighterASTNode node, StubElement parentStub) {
String refText = null;
List<String> to = ContainerUtil.newSmartList();
for (LighterASTNode child : tree.getChildren(node)) {
IElementType type = child.getTokenType();
if (type == JavaElementType.JAVA_CODE_REFERENCE)
refText = JavaSourceUtil.getReferenceText(tree, child);
else if (type == JavaElementType.MODULE_REFERENCE)
to.add(JavaSourceUtil.getReferenceText(tree, child));
}
return new PsiPackageAccessibilityStatementStubImpl(parentStub, this, refText, to);
}
Aggregations