Decomposer node properties
This commit is contained in:
@@ -53,7 +53,7 @@ public interface JetNodeTypes {
|
||||
JetNodeType TUPLE_TYPE = new JetNodeType("TUPLE_TYPE");
|
||||
JetNodeType FUNCTION_TYPE = new JetNodeType("FUNCTION_TYPE");
|
||||
JetNodeType SELF_TYPE = new JetNodeType("SELF_TYPE");
|
||||
JetNodeType DECOMPOSER_PROPERTY_LIST = new JetNodeType("DECOMPOSER_PROPERTY_LIST");
|
||||
JetNodeType DECOMPOSER_PROPERTY_LIST = new JetNodeType("DECOMPOSER_PROPERTY_LIST", JetDecomposerPropertyList.class);
|
||||
// TODO: review
|
||||
JetNodeType RECEIVER_TYPE_ATTRIBUTES = new JetNodeType("RECEIVER_TYPE_ATTRIBUTES");
|
||||
JetNodeType PROPERTY_ACCESSOR = new JetNodeType("PROPERTY_ACCESSOR");
|
||||
|
||||
@@ -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,16 @@ public class JetDecomposer extends JetNamedDeclaration {
|
||||
public void accept(@NotNull JetVisitor visitor) {
|
||||
visitor.visitDecomposer(this);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public JetDecomposerPropertyList getPropertyList() {
|
||||
return (JetDecomposerPropertyList) findChildByType(JetNodeTypes.DECOMPOSER_PROPERTY_LIST);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<JetReferenceExpression> getPropertyReferences() {
|
||||
JetDecomposerPropertyList list = getPropertyList();
|
||||
|
||||
return list != null ? list.getPropertyReferences() : Collections.<JetReferenceExpression>emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.jetbrains.jet.lang.psi;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.JetNodeTypes;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetDecomposerPropertyList extends JetNamedDeclaration {
|
||||
public JetDecomposerPropertyList(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(@NotNull JetVisitor visitor) {
|
||||
visitor.visitDecomposerPropertyList(this);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<JetReferenceExpression> getPropertyReferences() {
|
||||
return findChildrenByType(JetNodeTypes.REFERENCE_EXPRESSION);
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,10 @@ public class JetVisitor extends PsiElementVisitor {
|
||||
visitDeclaration(decomposer);
|
||||
}
|
||||
|
||||
public void visitDecomposerPropertyList(JetDecomposerPropertyList propertyList) {
|
||||
visitJetElement(propertyList);
|
||||
}
|
||||
|
||||
public void visitExtension(JetExtension extension) {
|
||||
visitDeclaration(extension);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user