Attribute node getters + cosmetic stuff
This commit is contained in:
@@ -5,7 +5,6 @@ package org.jetbrains.jet;
|
|||||||
|
|
||||||
import com.intellij.psi.tree.IElementType;
|
import com.intellij.psi.tree.IElementType;
|
||||||
import com.intellij.psi.tree.IFileElementType;
|
import com.intellij.psi.tree.IFileElementType;
|
||||||
import com.intellij.psi.tree.TokenSet;
|
|
||||||
import org.jetbrains.jet.lang.JetLanguage;
|
import org.jetbrains.jet.lang.JetLanguage;
|
||||||
import org.jetbrains.jet.lang.psi.*;
|
import org.jetbrains.jet.lang.psi.*;
|
||||||
|
|
||||||
@@ -113,8 +112,4 @@ public interface JetNodeTypes {
|
|||||||
JetNodeType ROOT_NAMESPACE = new JetNodeType("ROOT_NAMESPACE", JetRootNamespaceExpression.class);
|
JetNodeType ROOT_NAMESPACE = new JetNodeType("ROOT_NAMESPACE", JetRootNamespaceExpression.class);
|
||||||
|
|
||||||
IElementType NAMESPACE_NAME = new JetNodeType("NAMESPACE_NAME");
|
IElementType NAMESPACE_NAME = new JetNodeType("NAMESPACE_NAME");
|
||||||
|
|
||||||
TokenSet DECLARATIONS = TokenSet.create(
|
|
||||||
NAMESPACE, CLASS, PROPERTY, FUN, EXTENSION,
|
|
||||||
TYPEDEF, DECOMPOSER, CLASS_OBJECT, CONSTRUCTOR, ENUM_ENTRY, VALUE_PARAMETER);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,11 @@ package org.jetbrains.jet.lang.psi;
|
|||||||
|
|
||||||
import com.intellij.lang.ASTNode;
|
import com.intellij.lang.ASTNode;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import org.jetbrains.jet.JetNodeTypes;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author max
|
* @author max
|
||||||
@@ -15,4 +20,21 @@ public class JetAttribute extends JetElement {
|
|||||||
public void accept(JetVisitor visitor) {
|
public void accept(JetVisitor visitor) {
|
||||||
visitor.visitAttribute(this);
|
visitor.visitAttribute(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public JetTypeReference getTypeReference() {
|
||||||
|
return (JetTypeReference) findChildByType(JetNodeTypes.TYPE_REFERENCE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public JetArgumentList getArgumentList() {
|
||||||
|
return (JetArgumentList) findChildByType(JetNodeTypes.VALUE_ARGUMENT_LIST);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public List<JetArgument> getArguments() {
|
||||||
|
JetArgumentList list = getArgumentList();
|
||||||
|
return list != null ? list.getArguments() : Collections.<JetArgument>emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package org.jetbrains.jet.lang.psi;
|
package org.jetbrains.jet.lang.psi;
|
||||||
|
|
||||||
import com.intellij.lang.ASTNode;
|
import com.intellij.lang.ASTNode;
|
||||||
|
import com.intellij.psi.util.PsiTreeUtil;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.JetNodeTypes;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ public class JetClassBody extends JetElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<JetDeclaration> getDeclarations() {
|
public List<JetDeclaration> getDeclarations() {
|
||||||
return findChildrenByType(JetNodeTypes.DECLARATIONS);
|
return PsiTreeUtil.getChildrenOfTypeAsList(this, JetDeclaration.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package org.jetbrains.jet.lang.psi;
|
package org.jetbrains.jet.lang.psi;
|
||||||
|
|
||||||
import com.intellij.lang.ASTNode;
|
import com.intellij.lang.ASTNode;
|
||||||
|
import com.intellij.psi.util.PsiTreeUtil;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.JetNodeTypes;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ public class JetNamespaceBody extends JetElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<JetDeclaration> getDeclarations() {
|
public List<JetDeclaration> getDeclarations() {
|
||||||
return findChildrenByType(JetNodeTypes.DECLARATIONS);
|
return PsiTreeUtil.getChildrenOfTypeAsList(this, JetDeclaration.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user