class object, constructor nodes
This commit is contained in:
@@ -57,8 +57,8 @@ public interface JetNodeTypes {
|
||||
// TODO: review
|
||||
JetNodeType RECEIVER_TYPE_ATTRIBUTES = new JetNodeType("RECEIVER_TYPE_ATTRIBUTES");
|
||||
JetNodeType PROPERTY_ACCESSOR = new JetNodeType("PROPERTY_ACCESSOR");
|
||||
JetNodeType INITIALIZER_LIST = new JetNodeType("INITIALIZER_LIST");
|
||||
JetNodeType THIS_CALL = new JetNodeType("THIS_CALL");
|
||||
JetNodeType INITIALIZER_LIST = new JetNodeType("INITIALIZER_LIST", JetInitializerList.class);
|
||||
JetNodeType THIS_CALL = new JetNodeType("THIS_CALL", JetDelegatorToThisCall.class);
|
||||
JetNodeType TYPE_CONSTRAINT_LIST = new JetNodeType("TYPE_CONSTRAINT_LIST");
|
||||
JetNodeType TYPE_CONSTRAINT = new JetNodeType("TYPE_CONSTRAINT");
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.jetbrains.jet.lang.psi;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.JetNodeTypes;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
@@ -16,4 +17,8 @@ public class JetClassObject extends JetDeclaration {
|
||||
visitor.visitClassObject(this);
|
||||
}
|
||||
|
||||
public JetObjectLiteralExpression getObject() {
|
||||
return (JetObjectLiteralExpression) findChildByType(JetNodeTypes.OBJECT_LITERAL);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -16,4 +21,25 @@ public class JetConstructor extends JetDeclaration {
|
||||
visitor.visitConstructor(this);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public JetParameterList getParameterList() {
|
||||
return (JetParameterList) findChildByType(JetNodeTypes.VALUE_PARAMETER_LIST);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<JetParameter> getParameters() {
|
||||
JetParameterList list = getParameterList();
|
||||
return list != null ? list.getParameters() : Collections.<JetParameter>emptyList();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public JetInitializerList getInitializerList() {
|
||||
return (JetInitializerList) findChildByType(JetNodeTypes.INITIALIZER_LIST);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<JetDelegationSpecifier> getInitializers() {
|
||||
JetInitializerList list = getInitializerList();
|
||||
return list != null ? list.getInitializers() : Collections.<JetDelegationSpecifier>emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,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.JetNodeTypes;
|
||||
|
||||
/**
|
||||
@@ -17,6 +18,7 @@ public class JetDelegationSpecifier extends JetElement{
|
||||
visitor.visitDelegationSpecifier(this);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public JetTypeReference getTypeReference() {
|
||||
return (JetTypeReference) findChildByType(JetNodeTypes.TYPE_REFERENCE);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package org.jetbrains.jet.lang.psi;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.JetNodeTypes;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetDelegatorToThisCall extends JetDelegationSpecifier {
|
||||
public JetDelegatorToThisCall(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(JetVisitor visitor) {
|
||||
visitor.visitDelegationToThisCall(this);
|
||||
}
|
||||
|
||||
public JetArgumentList getArgumentList() {
|
||||
return (JetArgumentList) findChildByType(JetNodeTypes.VALUE_ARGUMENT_LIST);
|
||||
}
|
||||
|
||||
public List<JetArgument> getArguments() {
|
||||
JetArgumentList list = getArgumentList();
|
||||
return list != null ? list.getArguments() : Collections.<JetArgument>emptyList();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.jetbrains.jet.lang.psi;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetInitializerList extends JetElement {
|
||||
public JetInitializerList(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(JetVisitor visitor) {
|
||||
visitor.visitInitializerList(this);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<JetDelegationSpecifier> getInitializers() {
|
||||
return PsiTreeUtil.getChildrenOfTypeAsList(this, JetDelegationSpecifier.class);
|
||||
}
|
||||
}
|
||||
@@ -122,6 +122,10 @@ public class JetVisitor extends PsiElementVisitor {
|
||||
visitDelegationSpecifier(specifier);
|
||||
}
|
||||
|
||||
public void visitDelegationToThisCall(JetDelegatorToThisCall thisCall) {
|
||||
visitDelegationSpecifier(thisCall);
|
||||
}
|
||||
|
||||
public void visitTypeReference(JetTypeReference typeReference) {
|
||||
visitJetElement(typeReference);
|
||||
}
|
||||
@@ -269,4 +273,8 @@ public class JetVisitor extends PsiElementVisitor {
|
||||
public void visitParenthesizedExpression(JetParenthesizedExpression expression) {
|
||||
visitExpression(expression);
|
||||
}
|
||||
|
||||
public void visitInitializerList(JetInitializerList list) {
|
||||
visitJetElement(list);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user