diff --git a/compiler/frontend/src/org/jetbrains/jet/JetNodeTypes.java b/compiler/frontend/src/org/jetbrains/jet/JetNodeTypes.java index ee9ec9018a9..53176708714 100644 --- a/compiler/frontend/src/org/jetbrains/jet/JetNodeTypes.java +++ b/compiler/frontend/src/org/jetbrains/jet/JetNodeTypes.java @@ -52,7 +52,7 @@ public interface JetNodeTypes { IElementType CLASS_BODY = JetStubElementTypes.CLASS_BODY; IElementType IMPORT_LIST = JetStubElementTypes.IMPORT_LIST; - JetNodeType IMPORT_DIRECTIVE = new JetNodeType("IMPORT_DIRECTIVE", JetImportDirective.class); + IElementType IMPORT_DIRECTIVE = JetStubElementTypes.IMPORT_DIRECTIVE; JetNodeType MODIFIER_LIST = new JetNodeType("MODIFIER_LIST", JetModifierList.class); JetNodeType PRIMARY_CONSTRUCTOR_MODIFIER_LIST = new JetNodeType("PRIMARY_CONSTRUCTOR_MODIFIER_LIST", JetModifierList.class); JetNodeType ANNOTATION = new JetNodeType("ANNOTATION", JetAnnotation.class); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetImportDirective.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetImportDirective.java index 361d092d757..5910915ed3e 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetImportDirective.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetImportDirective.java @@ -17,16 +17,23 @@ package org.jetbrains.jet.lang.psi; import com.intellij.lang.ASTNode; +import com.intellij.psi.stubs.IStubElementType; import com.intellij.psi.tree.IElementType; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.jetbrains.jet.lang.psi.stubs.PsiJetImportDirectiveStub; +import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes; import org.jetbrains.jet.lexer.JetTokens; -public class JetImportDirective extends JetElementImpl { +public class JetImportDirective extends JetElementImplStub { public JetImportDirective(@NotNull ASTNode node) { super(node); } + public JetImportDirective(@NotNull PsiJetImportDirectiveStub stub) { + super(stub, JetStubElementTypes.IMPORT_DIRECTIVE); + } + @Override public R accept(@NotNull JetVisitor visitor, D data) { return visitor.visitImportDirective(this, data); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetImportDirectiveStub.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetImportDirectiveStub.java new file mode 100644 index 00000000000..0b1ca3c8b5b --- /dev/null +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetImportDirectiveStub.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.JetImportDirective; + +public interface PsiJetImportDirectiveStub extends StubElement { +} diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetImportDirectiveElementType.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetImportDirectiveElementType.java new file mode 100644 index 00000000000..0615708a791 --- /dev/null +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetImportDirectiveElementType.java @@ -0,0 +1,76 @@ +/* + * 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.JetImportDirective; +import org.jetbrains.jet.lang.psi.stubs.PsiJetImportDirectiveStub; +import org.jetbrains.jet.lang.psi.stubs.impl.PsiJetImportDirectiveStubImpl; + +import java.io.IOException; + +public class JetImportDirectiveElementType extends JetStubElementType { + public JetImportDirectiveElementType(@NotNull @NonNls String debugName) { + super(debugName); + } + + @Override + public JetImportDirective createPsiFromAst(@NotNull ASTNode node) { + return new JetImportDirective(node); + } + + @Override + public JetImportDirective createPsi(@NotNull PsiJetImportDirectiveStub stub) { + return new JetImportDirective(stub); + } + + @Override + public PsiJetImportDirectiveStub createStub( + @NotNull JetImportDirective psi, StubElement parentStub + ) { + return new PsiJetImportDirectiveStubImpl(parentStub); + } + + @Override + public void serialize( + @NotNull PsiJetImportDirectiveStub stub, @NotNull StubOutputStream dataStream + ) throws IOException { + //TODO: + } + + @NotNull + @Override + public PsiJetImportDirectiveStub deserialize( + @NotNull StubInputStream dataStream, StubElement parentStub + ) throws IOException { + //TODO + return new PsiJetImportDirectiveStubImpl(parentStub); + } + + @Override + public void indexStub( + @NotNull PsiJetImportDirectiveStub stub, @NotNull IndexSink sink + ) { + // do nothing + } +} 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 6331acaa38e..3b109820f10 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 @@ -33,4 +33,5 @@ public interface JetStubElementTypes { JetAnnotationElementType ANNOTATION_ENTRY = new JetAnnotationElementType("ANNOTATION_ENTRY"); JetClassBodyElementType CLASS_BODY = new JetClassBodyElementType("CLASS_BODY"); JetImportListElementType IMPORT_LIST = new JetImportListElementType("IMPORT_LIST"); + JetImportDirectiveElementType IMPORT_DIRECTIVE = new JetImportDirectiveElementType("IMPORT_DIRECTIVE"); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetImportDirectiveStubImpl.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetImportDirectiveStubImpl.java new file mode 100644 index 00000000000..d0c90b1027f --- /dev/null +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/PsiJetImportDirectiveStubImpl.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.JetImportDirective; +import org.jetbrains.jet.lang.psi.stubs.PsiJetImportDirectiveStub; +import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes; + +public class PsiJetImportDirectiveStubImpl extends StubBase implements PsiJetImportDirectiveStub { + public PsiJetImportDirectiveStubImpl(StubElement parent) { + super(parent, JetStubElementTypes.IMPORT_DIRECTIVE); + } +}