Stubs for JetImportDirective

This commit is contained in:
Pavel V. Talanov
2014-03-19 19:41:40 +04:00
parent 684ead7b58
commit b19288cd47
6 changed files with 138 additions and 2 deletions
@@ -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);
@@ -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<PsiJetImportDirectiveStub> {
public JetImportDirective(@NotNull ASTNode node) {
super(node);
}
public JetImportDirective(@NotNull PsiJetImportDirectiveStub stub) {
super(stub, JetStubElementTypes.IMPORT_DIRECTIVE);
}
@Override
public <R, D> R accept(@NotNull JetVisitor<R, D> visitor, D data) {
return visitor.visitImportDirective(this, data);
@@ -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<JetImportDirective> {
}
@@ -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<PsiJetImportDirectiveStub, JetImportDirective> {
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
}
}
@@ -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");
}
@@ -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<JetImportDirective> implements PsiJetImportDirectiveStub {
public PsiJetImportDirectiveStubImpl(StubElement parent) {
super(parent, JetStubElementTypes.IMPORT_DIRECTIVE);
}
}