From 684ead7b58da703086dbfa2c4717bfdc7cb9765e Mon Sep 17 00:00:00 2001 From: "Pavel V. Talanov" Date: Wed, 19 Mar 2014 19:29:00 +0400 Subject: [PATCH] Stubs for JetImportList --- .../src/org/jetbrains/jet/JetNodeTypes.java | 2 +- .../jetbrains/jet/lang/psi/JetImportList.java | 9 ++- .../lang/psi/stubs/PsiJetImportListStub.java | 23 +++++++ .../elements/JetImportListElementType.java | 69 +++++++++++++++++++ .../stubs/elements/JetStubElementTypes.java | 1 + .../stubs/impl/PsiJetImportListStubImpl.java | 30 ++++++++ 6 files changed, 132 insertions(+), 2 deletions(-) create mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetImportListStub.java create mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetImportListElementType.java create mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetImportListStubImpl.java diff --git a/compiler/frontend/src/org/jetbrains/jet/JetNodeTypes.java b/compiler/frontend/src/org/jetbrains/jet/JetNodeTypes.java index 1c559cd7b78..ee9ec9018a9 100644 --- a/compiler/frontend/src/org/jetbrains/jet/JetNodeTypes.java +++ b/compiler/frontend/src/org/jetbrains/jet/JetNodeTypes.java @@ -51,7 +51,7 @@ public interface JetNodeTypes { IElementType VALUE_PARAMETER = JetStubElementTypes.VALUE_PARAMETER; IElementType CLASS_BODY = JetStubElementTypes.CLASS_BODY; - JetNodeType IMPORT_LIST = new JetNodeType("IMPORT_LIST", JetImportList.class); + IElementType IMPORT_LIST = JetStubElementTypes.IMPORT_LIST; JetNodeType IMPORT_DIRECTIVE = new JetNodeType("IMPORT_DIRECTIVE", JetImportDirective.class); JetNodeType MODIFIER_LIST = new JetNodeType("MODIFIER_LIST", JetModifierList.class); JetNodeType PRIMARY_CONSTRUCTOR_MODIFIER_LIST = new JetNodeType("PRIMARY_CONSTRUCTOR_MODIFIER_LIST", JetModifierList.class); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetImportList.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetImportList.java index 045ee1789fb..62e6db41d49 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetImportList.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetImportList.java @@ -17,17 +17,24 @@ package org.jetbrains.jet.lang.psi; import com.intellij.lang.ASTNode; +import com.intellij.psi.stubs.StubElement; import com.intellij.psi.util.PsiTreeUtil; import org.jetbrains.annotations.NotNull; +import org.jetbrains.jet.lang.psi.stubs.PsiJetImportListStub; +import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes; import java.util.List; -public class JetImportList extends JetElementImpl { +public class JetImportList extends JetElementImplStub { public JetImportList(@NotNull ASTNode node) { super(node); } + public JetImportList(@NotNull PsiJetImportListStub stub) { + super(stub, JetStubElementTypes.IMPORT_LIST); + } + @Override public R accept(@NotNull JetVisitor visitor, D data) { return visitor.visitImportList(this, data); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetImportListStub.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetImportListStub.java new file mode 100644 index 00000000000..027f5e6b87f --- /dev/null +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetImportListStub.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.JetImportList; + +public interface PsiJetImportListStub extends StubElement { +} diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetImportListElementType.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetImportListElementType.java new file mode 100644 index 00000000000..e8d6072d692 --- /dev/null +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetImportListElementType.java @@ -0,0 +1,69 @@ +/* + * 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.JetImportList; +import org.jetbrains.jet.lang.psi.stubs.PsiJetImportListStub; +import org.jetbrains.jet.lang.psi.stubs.impl.PsiJetImportListStubImpl; + +import java.io.IOException; + +public class JetImportListElementType extends JetStubElementType { + public JetImportListElementType(@NotNull @NonNls String debugName) { + super(debugName); + } + + @Override + public JetImportList createPsiFromAst(@NotNull ASTNode node) { + return new JetImportList(node); + } + + @Override + public JetImportList createPsi(@NotNull PsiJetImportListStub stub) { + return new JetImportList(stub); + } + + @Override + public PsiJetImportListStub createStub( + @NotNull JetImportList psi, StubElement parentStub + ) { + return new PsiJetImportListStubImpl(parentStub); + } + + @Override + public void serialize(@NotNull PsiJetImportListStub stub, @NotNull StubOutputStream dataStream) throws IOException { + //do nothing; + } + + @NotNull + @Override + public PsiJetImportListStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException { + return new PsiJetImportListStubImpl(parentStub); + } + + @Override + public void indexStub(@NotNull PsiJetImportListStub stub, @NotNull IndexSink sink) { + //do nothing + } +} \ No newline at end of file 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 a0661701357..6331acaa38e 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 @@ -32,4 +32,5 @@ public interface JetStubElementTypes { JetTypeParameterListElementType TYPE_PARAMETER_LIST = new JetTypeParameterListElementType("TYPE_PARAMETER_LIST"); JetAnnotationElementType ANNOTATION_ENTRY = new JetAnnotationElementType("ANNOTATION_ENTRY"); JetClassBodyElementType CLASS_BODY = new JetClassBodyElementType("CLASS_BODY"); + JetImportListElementType IMPORT_LIST = new JetImportListElementType("IMPORT_LIST"); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetImportListStubImpl.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetImportListStubImpl.java new file mode 100644 index 00000000000..3d070cf7408 --- /dev/null +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetImportListStubImpl.java @@ -0,0 +1,30 @@ +/* + * 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.JetImportList; +import org.jetbrains.jet.lang.psi.stubs.PsiJetImportListStub; +import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes; + +public class PsiJetImportListStubImpl extends StubBase implements PsiJetImportListStub { + + public PsiJetImportListStubImpl(StubElement parent) { + super(parent, JetStubElementTypes.IMPORT_LIST); + } +}