Argument node
This commit is contained in:
@@ -3,6 +3,7 @@ package org.jetbrains.jet.lang.psi;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lexer.JetTokens;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
@@ -20,4 +21,21 @@ public class JetArgument extends JetElement {
|
||||
public JetExpression getArgumentExpression() {
|
||||
return findChildByClass(JetExpression.class);
|
||||
}
|
||||
|
||||
public String getArgumentName() {
|
||||
ASTNode firstChildNode = getNode().getFirstChildNode();
|
||||
return firstChildNode.getElementType() == JetTokens.IDENTIFIER ? firstChildNode.getText() : null;
|
||||
}
|
||||
|
||||
public boolean isNamed() {
|
||||
return getArgumentName() != null;
|
||||
}
|
||||
|
||||
public boolean isOut() {
|
||||
return findChildByType(JetTokens.OUT_KEYWORD) != null;
|
||||
}
|
||||
|
||||
public boolean isRef() {
|
||||
return findChildByType(JetTokens.REF_KEYWORD) != null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user