diff --git a/idea/src/org/jetbrains/jet/JetNodeTypes.java b/idea/src/org/jetbrains/jet/JetNodeTypes.java index df3d5c76355..cba0d7239fd 100644 --- a/idea/src/org/jetbrains/jet/JetNodeTypes.java +++ b/idea/src/org/jetbrains/jet/JetNodeTypes.java @@ -5,7 +5,6 @@ package org.jetbrains.jet; import com.intellij.psi.tree.IElementType; import com.intellij.psi.tree.IFileElementType; -import com.intellij.psi.tree.TokenSet; import org.jetbrains.jet.lang.JetLanguage; import org.jetbrains.jet.lang.psi.*; @@ -113,8 +112,4 @@ public interface JetNodeTypes { JetNodeType ROOT_NAMESPACE = new JetNodeType("ROOT_NAMESPACE", JetRootNamespaceExpression.class); 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); } diff --git a/idea/src/org/jetbrains/jet/lang/psi/JetAttribute.java b/idea/src/org/jetbrains/jet/lang/psi/JetAttribute.java index 8ad6416ad34..89e19875349 100644 --- a/idea/src/org/jetbrains/jet/lang/psi/JetAttribute.java +++ b/idea/src/org/jetbrains/jet/lang/psi/JetAttribute.java @@ -2,6 +2,11 @@ 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.JetNodeTypes; + +import java.util.Collections; +import java.util.List; /** * @author max @@ -15,4 +20,21 @@ public class JetAttribute extends JetElement { public void accept(JetVisitor visitor) { 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 getArguments() { + JetArgumentList list = getArgumentList(); + return list != null ? list.getArguments() : Collections.emptyList(); + } + } diff --git a/idea/src/org/jetbrains/jet/lang/psi/JetClassBody.java b/idea/src/org/jetbrains/jet/lang/psi/JetClassBody.java index 804952e4b3d..2b10b9bb5d3 100644 --- a/idea/src/org/jetbrains/jet/lang/psi/JetClassBody.java +++ b/idea/src/org/jetbrains/jet/lang/psi/JetClassBody.java @@ -1,8 +1,8 @@ package org.jetbrains.jet.lang.psi; import com.intellij.lang.ASTNode; +import com.intellij.psi.util.PsiTreeUtil; import org.jetbrains.annotations.NotNull; -import org.jetbrains.jet.JetNodeTypes; import java.util.List; @@ -15,7 +15,7 @@ public class JetClassBody extends JetElement { } public List getDeclarations() { - return findChildrenByType(JetNodeTypes.DECLARATIONS); + return PsiTreeUtil.getChildrenOfTypeAsList(this, JetDeclaration.class); } @Override diff --git a/idea/src/org/jetbrains/jet/lang/psi/JetNamespaceBody.java b/idea/src/org/jetbrains/jet/lang/psi/JetNamespaceBody.java index fe45025ab3a..ee3a9ed4d48 100644 --- a/idea/src/org/jetbrains/jet/lang/psi/JetNamespaceBody.java +++ b/idea/src/org/jetbrains/jet/lang/psi/JetNamespaceBody.java @@ -1,8 +1,8 @@ package org.jetbrains.jet.lang.psi; import com.intellij.lang.ASTNode; +import com.intellij.psi.util.PsiTreeUtil; import org.jetbrains.annotations.NotNull; -import org.jetbrains.jet.JetNodeTypes; import java.util.List; @@ -15,7 +15,7 @@ public class JetNamespaceBody extends JetElement { } public List getDeclarations() { - return findChildrenByType(JetNodeTypes.DECLARATIONS); + return PsiTreeUtil.getChildrenOfTypeAsList(this, JetDeclaration.class); } @Override