Delegation specifiers, initial

This commit is contained in:
Maxim Shafirov
2011-01-06 18:20:35 +03:00
parent dae656806e
commit 3c302d8128
10 changed files with 207 additions and 7 deletions
+7 -7
View File
@@ -26,10 +26,10 @@ public interface JetNodeTypes {
JetNodeType TYPE_PARAMETER_LIST = new JetNodeType("TYPE_PARAMETER_LIST", JetTypeParameterList.class);
JetNodeType TYPE_PARAMETER = new JetNodeType("TYPE_PARAMETER", JetTypeParameter.class);
JetNodeType DELEGATION_SPECIFIER_LIST = new JetNodeType("DELEGATION_SPECIFIER_LIST");
JetNodeType DELEGATOR_BY = new JetNodeType("DELEGATOR_BY");
JetNodeType DELEGATOR_SUPER_CALL = new JetNodeType("DELEGATOR_SUPER_CALL");
JetNodeType DELEGATOR_SUPER_CLASS = new JetNodeType("DELEGATOR_SUPER_CLASS");
JetNodeType DELEGATION_SPECIFIER_LIST = new JetNodeType("DELEGATION_SPECIFIER_LIST", JetDelegationSpecifierList.class);
JetNodeType DELEGATOR_BY = new JetNodeType("DELEGATOR_BY", JetDelegatorByExpressionSpecifier.class);
JetNodeType DELEGATOR_SUPER_CALL = new JetNodeType("DELEGATOR_SUPER_CALL", JetDelegatorToSuperCall.class);
JetNodeType DELEGATOR_SUPER_CLASS = new JetNodeType("DELEGATOR_SUPER_CLASS", JetDelegatorToSuperClass.class);
JetNodeType VALUE_PARAMETER_LIST = new JetNodeType("VALUE_PARAMETER_LIST", JetParameterList.class);
JetNodeType VALUE_PARAMETER = new JetNodeType("VALUE_PARAMETER", JetParameter.class);
// TODO: Not sure if we really need separate PSI nodes for the class parameters?
@@ -45,9 +45,9 @@ public interface JetNodeTypes {
JetNodeType ATTRIBUTE = new JetNodeType("ATTRIBUTE", JetAttribute.class);
JetNodeType USER_TYPE = new JetNodeType("USER_TYPE");
JetNodeType TYPE_ARGUMENT_LIST = new JetNodeType("TYPE_ARGUMENT_LIST");
JetNodeType VALUE_ARGUMENT_LIST = new JetNodeType("VALUE_ARGUMENT_LIST");
JetNodeType VALUE_ARGUMENT = new JetNodeType("VALUE_ARGUMENT");
JetNodeType TYPE_REFERENCE = new JetNodeType("TYPE_REFERENCE");
JetNodeType VALUE_ARGUMENT_LIST = new JetNodeType("VALUE_ARGUMENT_LIST", JetArgumentList.class);
JetNodeType VALUE_ARGUMENT = new JetNodeType("VALUE_ARGUMENT", JetArgument.class);
JetNodeType TYPE_REFERENCE = new JetNodeType("TYPE_REFERENCE", JetTypeReference.class);
JetNodeType LABELED_TUPLE_ENTRY = new JetNodeType("LABELED_TUPLE_ENTRY");
JetNodeType TUPLE_TYPE = new JetNodeType("TUPLE_TYPE");
JetNodeType FUNCTION_TYPE = new JetNodeType("FUNCTION_TYPE");
@@ -0,0 +1,17 @@
package org.jetbrains.jet.lang.psi;
import com.intellij.lang.ASTNode;
import org.jetbrains.annotations.NotNull;
/**
* @author max
*/
public class JetArgument extends JetElement {
public JetArgument(@NotNull ASTNode node) {
super(node);
}
public void accept(JetVisitor visitor) {
visitor.visitArgument(this);
}
}
@@ -0,0 +1,25 @@
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 JetArgumentList extends JetElement {
public JetArgumentList(@NotNull ASTNode node) {
super(node);
}
@Override
public void accept(JetVisitor visitor) {
visitor.visitArgumentList(this);
}
public List<JetArgument> getArguments() {
return findChildrenByType(JetNodeTypes.VALUE_ARGUMENT);
}
}
@@ -0,0 +1,23 @@
package org.jetbrains.jet.lang.psi;
import com.intellij.lang.ASTNode;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.JetNodeTypes;
/**
* @author max
*/
public class JetDelegationSpecifier extends JetElement{
public JetDelegationSpecifier(@NotNull ASTNode node) {
super(node);
}
@Override
public void accept(JetVisitor visitor) {
visitor.visitDelegationSpecifier(this);
}
public JetTypeReference getTypeReference() {
return (JetTypeReference) findChildByType(JetNodeTypes.TYPE_REFERENCE);
}
}
@@ -0,0 +1,18 @@
package org.jetbrains.jet.lang.psi;
import com.intellij.lang.ASTNode;
import org.jetbrains.annotations.NotNull;
/**
* @author max
*/
public class JetDelegationSpecifierList extends JetElement {
public JetDelegationSpecifierList(@NotNull ASTNode node) {
super(node);
}
@Override
public void accept(JetVisitor visitor) {
visitor.visitDelegationSpecifierList(this);
}
}
@@ -0,0 +1,18 @@
package org.jetbrains.jet.lang.psi;
import com.intellij.lang.ASTNode;
import org.jetbrains.annotations.NotNull;
/**
* @author max
*/
public class JetDelegatorByExpressionSpecifier extends JetDelegationSpecifier {
public JetDelegatorByExpressionSpecifier(@NotNull ASTNode node) {
super(node);
}
@Override
public void accept(JetVisitor visitor) {
visitor.visitDelegationByExpressionSpecifier(this);
}
}
@@ -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 JetDelegatorToSuperCall extends JetDelegationSpecifier {
public JetDelegatorToSuperCall(@NotNull ASTNode node) {
super(node);
}
@Override
public void accept(JetVisitor visitor) {
visitor.visitDelegationToSuperCallSpecifier(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,18 @@
package org.jetbrains.jet.lang.psi;
import com.intellij.lang.ASTNode;
import org.jetbrains.annotations.NotNull;
/**
* @author max
*/
public class JetDelegatorToSuperClass extends JetDelegationSpecifier {
public JetDelegatorToSuperClass(@NotNull ASTNode node) {
super(node);
}
@Override
public void accept(JetVisitor visitor) {
visitor.visitDelegationToSuperClassSpecifier(this);
}
}
@@ -0,0 +1,18 @@
package org.jetbrains.jet.lang.psi;
import com.intellij.lang.ASTNode;
import org.jetbrains.annotations.NotNull;
/**
* @author max
*/
public class JetTypeReference extends JetElement {
public JetTypeReference(@NotNull ASTNode node) {
super(node);
}
@Override
public void accept(JetVisitor visitor) {
visitor.visitTypeReference(this);
}
}
@@ -97,4 +97,36 @@ public class JetVisitor extends PsiElementVisitor {
public void visitParameter(JetParameter parameter) {
visitDeclaration(parameter);
}
public void visitDelegationSpecifierList(JetDelegationSpecifierList list) {
visitJetElement(list);
}
public void visitDelegationSpecifier(JetDelegationSpecifier specifier) {
visitJetElement(specifier);
}
public void visitDelegationByExpressionSpecifier(JetDelegatorByExpressionSpecifier specifier) {
visitDelegationSpecifier(specifier);
}
public void visitDelegationToSuperCallSpecifier(JetDelegatorToSuperCall call) {
visitDelegationSpecifier(call);
}
public void visitDelegationToSuperClassSpecifier(JetDelegatorToSuperClass specifier) {
visitDelegationSpecifier(specifier);
}
public void visitTypeReference(JetTypeReference typeReference) {
visitJetElement(typeReference);
}
public void visitArgumentList(JetArgumentList list) {
visitJetElement(list);
}
public void visitArgument(JetArgument argument) {
visitJetElement(argument);
}
}