use of com.intellij.lang.ASTNode in project kotlin by JetBrains.
the class KtProperty method getReceiverTypeRefByTree.
@Nullable
private KtTypeReference getReceiverTypeRefByTree() {
ASTNode node = getNode().getFirstChildNode();
while (node != null) {
IElementType tt = node.getElementType();
if (tt == KtTokens.COLON)
break;
if (tt == KtNodeTypes.TYPE_REFERENCE) {
return (KtTypeReference) node.getPsi();
}
node = node.getTreeNext();
}
return null;
}
use of com.intellij.lang.ASTNode in project kotlin by JetBrains.
the class KtImportDirective method getAliasName.
@Nullable
public String getAliasName() {
KotlinImportDirectiveStub stub = getStub();
if (stub != null) {
return stub.getAliasName();
}
ASTNode aliasNameNode = getAliasNameNode();
if (aliasNameNode == null) {
return null;
}
return aliasNameNode.getText();
}
use of com.intellij.lang.ASTNode in project kotlin by JetBrains.
the class KtStubElementType method createStubDependingOnParent.
private static boolean createStubDependingOnParent(ASTNode node) {
ASTNode parent = node.getTreeParent();
IElementType parentType = parent.getElementType();
if (parentType instanceof IStubElementType) {
return ((IStubElementType) parentType).shouldCreateStub(parent);
}
if (parentType instanceof IStubFileElementType) {
return true;
}
return false;
}
use of com.intellij.lang.ASTNode in project kotlin by JetBrains.
the class KtBinaryExpression method getRight.
@Nullable
@IfNotParsed
public KtExpression getRight() {
ASTNode node = getOperationReference().getNode().getTreeNext();
while (node != null) {
PsiElement psi = node.getPsi();
if (psi instanceof KtExpression) {
return (KtExpression) psi;
}
node = node.getTreeNext();
}
return null;
}
use of com.intellij.lang.ASTNode in project intellij-community by JetBrains.
the class PyArgumentListImpl method getKeywordArgument.
@Nullable
public PyKeywordArgument getKeywordArgument(String name) {
ASTNode node = getNode().getFirstChildNode();
while (node != null) {
if (node.getElementType() == PyElementTypes.KEYWORD_ARGUMENT_EXPRESSION) {
PyKeywordArgument arg = (PyKeywordArgument) node.getPsi();
String keyword = arg.getKeyword();
if (keyword != null && keyword.equals(name))
return arg;
}
node = node.getTreeNext();
}
return null;
}
Aggregations