From 76608ff01baf70b4f44afe536b82c91159620567 Mon Sep 17 00:00:00 2001 From: "Pavel V. Talanov" Date: Fri, 4 Apr 2014 18:43:04 +0400 Subject: [PATCH] Stubs for delegation specifiers --- .../frontend/src/org/jetbrains/jet/JetNodeTypes.java | 8 ++++---- .../jetbrains/jet/lang/psi/JetDelegationSpecifier.java | 10 +++++++++- .../lang/psi/JetDelegatorByExpressionSpecifier.java | 6 ++++++ .../jet/lang/psi/JetDelegatorToSuperCall.java | 6 ++++++ .../jet/lang/psi/JetDelegatorToSuperClass.java | 6 ++++++ .../jetbrains/jet/lang/psi/JetDelegatorToThisCall.java | 7 +++++++ .../lang/psi/stubs/elements/JetStubElementTypes.java | 10 ++++++++++ 7 files changed, 48 insertions(+), 5 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/jet/JetNodeTypes.java b/compiler/frontend/src/org/jetbrains/jet/JetNodeTypes.java index c5ff473844e..7e46068a1ab 100644 --- a/compiler/frontend/src/org/jetbrains/jet/JetNodeTypes.java +++ b/compiler/frontend/src/org/jetbrains/jet/JetNodeTypes.java @@ -42,9 +42,9 @@ public interface JetNodeTypes { IElementType TYPE_PARAMETER_LIST = JetStubElementTypes.TYPE_PARAMETER_LIST; IElementType TYPE_PARAMETER = JetStubElementTypes.TYPE_PARAMETER; IElementType DELEGATION_SPECIFIER_LIST = JetStubElementTypes.DELEGATION_SPECIFIER_LIST; - 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); + IElementType DELEGATOR_BY = JetStubElementTypes.DELEGATOR_BY; + IElementType DELEGATOR_SUPER_CALL = JetStubElementTypes.DELEGATOR_SUPER_CALL; + IElementType DELEGATOR_SUPER_CLASS = JetStubElementTypes.DELEGATOR_SUPER_CLASS; JetNodeType PROPERTY_DELEGATE = new JetNodeType("PROPERTY_DELEGATE", JetPropertyDelegate.class); JetNodeType CONSTRUCTOR_CALLEE = new JetNodeType("CONSTRUCTOR_CALLEE", JetConstructorCalleeExpression.class); IElementType VALUE_PARAMETER_LIST = JetStubElementTypes.VALUE_PARAMETER_LIST; @@ -74,7 +74,7 @@ public interface JetNodeTypes { // TODO: review JetNodeType PROPERTY_ACCESSOR = new JetNodeType("PROPERTY_ACCESSOR", JetPropertyAccessor.class); JetNodeType INITIALIZER_LIST = new JetNodeType("INITIALIZER_LIST", JetInitializerList.class); - JetNodeType THIS_CALL = new JetNodeType("THIS_CALL", JetDelegatorToThisCall.class); + IElementType THIS_CALL = JetStubElementTypes.THIS_CALL; JetNodeType THIS_CONSTRUCTOR_REFERENCE = new JetNodeType("THIS_CONSTRUCTOR_REFERENCE", JetThisReferenceExpression.class); IElementType TYPE_CONSTRAINT_LIST = JetStubElementTypes.TYPE_CONSTRAINT_LIST; JetNodeType TYPE_CONSTRAINT = new JetNodeType("TYPE_CONSTRAINT", JetTypeConstraint.class); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetDelegationSpecifier.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetDelegationSpecifier.java index 479e1dba7a9..92fe0bf6fe8 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetDelegationSpecifier.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetDelegationSpecifier.java @@ -17,15 +17,23 @@ package org.jetbrains.jet.lang.psi; import com.intellij.lang.ASTNode; +import com.intellij.psi.stubs.IStubElementType; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.jet.JetNodeTypes; +import org.jetbrains.jet.lang.psi.stubs.PsiJetPlaceHolderStub; -public class JetDelegationSpecifier extends JetElementImpl { +public class JetDelegationSpecifier extends JetElementImplStub> { public JetDelegationSpecifier(@NotNull ASTNode node) { super(node); } + public JetDelegationSpecifier( + @NotNull PsiJetPlaceHolderStub stub, + @NotNull IStubElementType nodeType) { + super(stub, nodeType); + } + @Override public R accept(@NotNull JetVisitor visitor, D data) { return visitor.visitDelegationSpecifier(this, data); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetDelegatorByExpressionSpecifier.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetDelegatorByExpressionSpecifier.java index b531239455b..6514747c97e 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetDelegatorByExpressionSpecifier.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetDelegatorByExpressionSpecifier.java @@ -19,12 +19,18 @@ 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.lang.psi.stubs.PsiJetPlaceHolderStub; +import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes; public class JetDelegatorByExpressionSpecifier extends JetDelegationSpecifier { public JetDelegatorByExpressionSpecifier(@NotNull ASTNode node) { super(node); } + public JetDelegatorByExpressionSpecifier(@NotNull PsiJetPlaceHolderStub stub) { + super(stub, JetStubElementTypes.DELEGATOR_BY); + } + @Override public R accept(@NotNull JetVisitor visitor, D data) { return visitor.visitDelegationByExpressionSpecifier(this, data); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetDelegatorToSuperCall.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetDelegatorToSuperCall.java index b1a9fb6ef4c..efe03d83e75 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetDelegatorToSuperCall.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetDelegatorToSuperCall.java @@ -20,6 +20,8 @@ import com.intellij.lang.ASTNode; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.jet.JetNodeTypes; +import org.jetbrains.jet.lang.psi.stubs.PsiJetPlaceHolderStub; +import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes; import java.util.Collections; import java.util.List; @@ -29,6 +31,10 @@ public class JetDelegatorToSuperCall extends JetDelegationSpecifier implements J super(node); } + public JetDelegatorToSuperCall(@NotNull PsiJetPlaceHolderStub stub) { + super(stub, JetStubElementTypes.DELEGATOR_SUPER_CALL); + } + @Override public R accept(@NotNull JetVisitor visitor, D data) { return visitor.visitDelegationToSuperCallSpecifier(this, data); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetDelegatorToSuperClass.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetDelegatorToSuperClass.java index 8c9b835c595..f9a7bfc29e0 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetDelegatorToSuperClass.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetDelegatorToSuperClass.java @@ -18,12 +18,18 @@ package org.jetbrains.jet.lang.psi; import com.intellij.lang.ASTNode; import org.jetbrains.annotations.NotNull; +import org.jetbrains.jet.lang.psi.stubs.PsiJetPlaceHolderStub; +import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes; public class JetDelegatorToSuperClass extends JetDelegationSpecifier { public JetDelegatorToSuperClass(@NotNull ASTNode node) { super(node); } + public JetDelegatorToSuperClass(@NotNull PsiJetPlaceHolderStub stub) { + super(stub, JetStubElementTypes.DELEGATOR_SUPER_CLASS); + } + @Override public R accept(@NotNull JetVisitor visitor, D data) { return visitor.visitDelegationToSuperClassSpecifier(this, data); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetDelegatorToThisCall.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetDelegatorToThisCall.java index 505e9a809a0..d8a1fcacbc2 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetDelegatorToThisCall.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetDelegatorToThisCall.java @@ -17,9 +17,12 @@ package org.jetbrains.jet.lang.psi; import com.intellij.lang.ASTNode; +import com.intellij.psi.stubs.IStubElementType; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.jet.JetNodeTypes; +import org.jetbrains.jet.lang.psi.stubs.PsiJetPlaceHolderStub; +import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes; import java.util.Collections; import java.util.List; @@ -30,6 +33,10 @@ public class JetDelegatorToThisCall extends JetDelegationSpecifier implements Je super(node); } + public JetDelegatorToThisCall(@NotNull PsiJetPlaceHolderStub stub) { + super(stub, JetStubElementTypes.THIS_CALL); + } + @Override public R accept(@NotNull JetVisitor visitor, D data) { return visitor.visitDelegationToThisCall(this, data); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetStubElementTypes.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetStubElementTypes.java index dd90b503e96..554e5a83043 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetStubElementTypes.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetStubElementTypes.java @@ -85,6 +85,16 @@ public interface JetStubElementTypes { JetPlaceHolderStubElementType DELEGATION_SPECIFIER_LIST = new JetPlaceHolderStubElementType("DELEGATION_SPECIFIER_LIST", JetDelegationSpecifierList.class); + + JetPlaceHolderStubElementType DELEGATOR_BY = + new JetPlaceHolderStubElementType("DELEGATOR_BY", JetDelegatorByExpressionSpecifier.class); + JetPlaceHolderStubElementType DELEGATOR_SUPER_CALL = + new JetPlaceHolderStubElementType("DELEGATOR_SUPER_CALL", JetDelegatorToSuperCall.class); + JetPlaceHolderStubElementType DELEGATOR_SUPER_CLASS = + new JetPlaceHolderStubElementType("DELEGATOR_SUPER_CLASS", JetDelegatorToSuperClass.class); + JetPlaceHolderStubElementType THIS_CALL = + new JetPlaceHolderStubElementType("THIS_CALL", JetDelegatorToThisCall.class); + TokenSet DECLARATION_TYPES = TokenSet.create(CLASS, OBJECT_DECLARATION, CLASS_OBJECT, FUNCTION, PROPERTY, ANONYMOUS_INITIALIZER, ENUM_ENTRY);