Stubs for JetImportList

This commit is contained in:
Pavel V. Talanov
2014-03-19 19:29:00 +04:00
parent 43e22ab5c1
commit 684ead7b58
6 changed files with 132 additions and 2 deletions
@@ -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);
@@ -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<PsiJetImportListStub> {
public JetImportList(@NotNull ASTNode node) {
super(node);
}
public JetImportList(@NotNull PsiJetImportListStub stub) {
super(stub, JetStubElementTypes.IMPORT_LIST);
}
@Override
public <R, D> R accept(@NotNull JetVisitor<R, D> visitor, D data) {
return visitor.visitImportList(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.JetImportList;
public interface PsiJetImportListStub extends StubElement<JetImportList> {
}
@@ -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<PsiJetImportListStub, JetImportList> {
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
}
}
@@ -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");
}
@@ -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<JetImportList> implements PsiJetImportListStub {
public PsiJetImportListStubImpl(StubElement parent) {
super(parent, JetStubElementTypes.IMPORT_LIST);
}
}