From 5c0202c735c047228ee43a92fa34e98e5b65824a Mon Sep 17 00:00:00 2001 From: "Pavel V. Talanov" Date: Thu, 20 Mar 2014 14:47:29 +0400 Subject: [PATCH] Stubs for JetTypeConstraintList --- .../src/org/jetbrains/jet/JetNodeTypes.java | 3 +- .../jet/lang/psi/JetTypeConstraintList.java | 9 ++- .../stubs/PsiJetTypeConstraintListStub.java | 23 ++++++ .../stubs/elements/JetStubElementTypes.java | 2 + .../JetTypeConstraintListElementType.java | 75 +++++++++++++++++++ .../PsiJetTypeConstraintListStubImpl.java | 29 +++++++ 6 files changed, 139 insertions(+), 2 deletions(-) create mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetTypeConstraintListStub.java create mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetTypeConstraintListElementType.java create mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetTypeConstraintListStubImpl.java diff --git a/compiler/frontend/src/org/jetbrains/jet/JetNodeTypes.java b/compiler/frontend/src/org/jetbrains/jet/JetNodeTypes.java index 9f5ef0875a3..0d8ad1f95c7 100644 --- a/compiler/frontend/src/org/jetbrains/jet/JetNodeTypes.java +++ b/compiler/frontend/src/org/jetbrains/jet/JetNodeTypes.java @@ -19,6 +19,7 @@ package org.jetbrains.jet; import com.intellij.psi.tree.IElementType; import com.intellij.psi.tree.IFileElementType; import org.jetbrains.jet.lang.psi.*; +import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementType; import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes; import org.jetbrains.jet.plugin.JetLanguage; @@ -77,7 +78,7 @@ public interface JetNodeTypes { JetNodeType INITIALIZER_LIST = new JetNodeType("INITIALIZER_LIST", JetInitializerList.class); JetNodeType THIS_CALL = new JetNodeType("THIS_CALL", JetDelegatorToThisCall.class); JetNodeType THIS_CONSTRUCTOR_REFERENCE = new JetNodeType("THIS_CONSTRUCTOR_REFERENCE", JetThisReferenceExpression.class); - JetNodeType TYPE_CONSTRAINT_LIST = new JetNodeType("TYPE_CONSTRAINT_LIST", JetTypeConstraintList.class); + IElementType TYPE_CONSTRAINT_LIST = JetStubElementTypes.TYPE_CONSTRAINT_LIST; JetNodeType TYPE_CONSTRAINT = new JetNodeType("TYPE_CONSTRAINT", JetTypeConstraint.class); // TODO: Not sure if we need separate NT for each kind of constants diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetTypeConstraintList.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetTypeConstraintList.java index 30552e026e0..cd2515019d7 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetTypeConstraintList.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetTypeConstraintList.java @@ -17,16 +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.jet.JetNodeTypes; +import org.jetbrains.jet.lang.psi.stubs.PsiJetTypeConstraintListStub; +import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes; import java.util.List; -public class JetTypeConstraintList extends JetElementImpl { +public class JetTypeConstraintList extends JetElementImplStub { public JetTypeConstraintList(@NotNull ASTNode node) { super(node); } + public JetTypeConstraintList(@NotNull PsiJetTypeConstraintListStub stub) { + super(stub, JetStubElementTypes.TYPE_CONSTRAINT_LIST); + } + @Override public R accept(@NotNull JetVisitor visitor, D data) { return visitor.visitTypeConstraintList(this, data); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetTypeConstraintListStub.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetTypeConstraintListStub.java new file mode 100644 index 00000000000..a2e11078715 --- /dev/null +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetTypeConstraintListStub.java @@ -0,0 +1,23 @@ +/* + * Copyright 2010-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.jet.lang.psi.stubs; + +import com.intellij.psi.stubs.StubElement; +import org.jetbrains.jet.lang.psi.JetTypeConstraintList; + +public interface PsiJetTypeConstraintListStub extends StubElement { +} 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 cae3e037315..5a3ed37b751 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 @@ -37,4 +37,6 @@ public interface JetStubElementTypes { JetModifierListElementType MODIFIER_LIST = new JetModifierListElementType("MODIFIER_LIST"); JetModifierListElementType PRIMARY_CONSTRUCTOR_MODIFIER_LIST = new JetModifierListElementType("PRIMARY_CONSTRUCTOR_MODIFIER_LIST"); + + JetTypeConstraintListElementType TYPE_CONSTRAINT_LIST = new JetTypeConstraintListElementType("TYPE_CONSTRAINT_LIST"); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetTypeConstraintListElementType.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetTypeConstraintListElementType.java new file mode 100644 index 00000000000..6de3344d4d1 --- /dev/null +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetTypeConstraintListElementType.java @@ -0,0 +1,75 @@ +/* + * Copyright 2010-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.jet.lang.psi.stubs.elements; + +import com.intellij.lang.ASTNode; +import com.intellij.psi.stubs.IndexSink; +import com.intellij.psi.stubs.StubElement; +import com.intellij.psi.stubs.StubInputStream; +import com.intellij.psi.stubs.StubOutputStream; +import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.jet.lang.psi.JetTypeConstraintList; +import org.jetbrains.jet.lang.psi.stubs.PsiJetTypeConstraintListStub; +import org.jetbrains.jet.lang.psi.stubs.impl.PsiJetTypeConstraintListStubImpl; + +import java.io.IOException; + +public class JetTypeConstraintListElementType extends JetStubElementType { + public JetTypeConstraintListElementType(@NotNull @NonNls String debugName) { + super(debugName); + } + + @Override + public JetTypeConstraintList createPsiFromAst(@NotNull ASTNode node) { + return new JetTypeConstraintList(node); + } + + @Override + public JetTypeConstraintList createPsi(@NotNull PsiJetTypeConstraintListStub stub) { + return new JetTypeConstraintList(stub); + } + + @Override + public PsiJetTypeConstraintListStub createStub( + @NotNull JetTypeConstraintList psi, StubElement parentStub + ) { + return new PsiJetTypeConstraintListStubImpl(parentStub); + } + + @Override + public void serialize( + @NotNull PsiJetTypeConstraintListStub stub, @NotNull StubOutputStream dataStream + ) throws IOException { + //TODO: + } + + @NotNull + @Override + public PsiJetTypeConstraintListStub deserialize( + @NotNull StubInputStream dataStream, StubElement parentStub + ) throws IOException { + throw new UnsupportedOperationException("org.jetbrains.jet.lang.psi.stubs.elements.JetTypeConstraintListElementType#deserialize"); + } + + @Override + public void indexStub( + @NotNull PsiJetTypeConstraintListStub stub, @NotNull IndexSink sink + ) { + //do nothing + } +} diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetTypeConstraintListStubImpl.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetTypeConstraintListStubImpl.java new file mode 100644 index 00000000000..d7ba0db52bb --- /dev/null +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetTypeConstraintListStubImpl.java @@ -0,0 +1,29 @@ +/* + * Copyright 2010-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.jet.lang.psi.stubs.impl; + +import com.intellij.psi.stubs.StubBase; +import com.intellij.psi.stubs.StubElement; +import org.jetbrains.jet.lang.psi.JetTypeConstraintList; +import org.jetbrains.jet.lang.psi.stubs.PsiJetTypeConstraintListStub; +import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes; + +public class PsiJetTypeConstraintListStubImpl extends StubBase implements PsiJetTypeConstraintListStub { + public PsiJetTypeConstraintListStubImpl(StubElement parent) { + super(parent, JetStubElementTypes.TYPE_CONSTRAINT_LIST); + } +}