Stubs for JetClassBody

This commit is contained in:
Pavel V. Talanov
2013-08-07 21:27:34 +04:00
parent c6484ab4c3
commit b2f2d43919
8 changed files with 159 additions and 21 deletions
@@ -50,7 +50,7 @@ public interface JetNodeTypes {
IElementType VALUE_PARAMETER_LIST = JetStubElementTypes.VALUE_PARAMETER_LIST;
IElementType VALUE_PARAMETER = JetStubElementTypes.VALUE_PARAMETER;
JetNodeType CLASS_BODY = new JetNodeType("CLASS_BODY", JetClassBody.class);
IElementType CLASS_BODY = JetStubElementTypes.CLASS_BODY;
JetNodeType IMPORT_LIST = new JetNodeType("IMPORT_LIST", JetImportList.class);
JetNodeType IMPORT_DIRECTIVE = new JetNodeType("IMPORT_DIRECTIVE", JetImportDirective.class);
JetNodeType MODIFIER_LIST = new JetNodeType("MODIFIER_LIST", JetModifierList.class);
@@ -18,20 +18,27 @@ package org.jetbrains.jet.lang.psi;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement;
import com.intellij.psi.stubs.IStubElementType;
import com.intellij.psi.stubs.StubElement;
import com.intellij.psi.tree.TokenSet;
import com.intellij.psi.util.PsiTreeUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.JetNodeTypes;
import org.jetbrains.jet.lang.psi.stubs.PsiJetClassBodyStub;
import org.jetbrains.jet.lexer.JetTokens;
import java.util.List;
public class JetClassBody extends JetElementImpl implements JetDeclarationContainer {
public class JetClassBody extends JetElementImplStub<PsiJetClassBodyStub> implements JetDeclarationContainer {
public JetClassBody(@NotNull ASTNode node) {
super(node);
}
public JetClassBody(@NotNull PsiJetClassBodyStub stub, @NotNull IStubElementType nodeType) {
super(stub, nodeType);
}
@Override
@NotNull
public List<JetDeclaration> getDeclarations() {
@@ -0,0 +1,23 @@
/*
* Copyright 2010-2013 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.JetClassBody;
public interface PsiJetClassBodyStub extends StubElement<JetClassBody> {
}
@@ -0,0 +1,67 @@
/*
* Copyright 2010-2013 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.JetClassBody;
import org.jetbrains.jet.lang.psi.stubs.PsiJetClassBodyStub;
import org.jetbrains.jet.lang.psi.stubs.impl.PsiJetClassBodyStubImpl;
import java.io.IOException;
public class JetClassBodyElementType extends JetStubElementType<PsiJetClassBodyStub, JetClassBody> {
public JetClassBodyElementType(@NotNull @NonNls String debugName) {
super(debugName);
}
@Override
public JetClassBody createPsiFromAst(@NotNull ASTNode node) {
return new JetClassBody(node);
}
@Override
public JetClassBody createPsi(@NotNull PsiJetClassBodyStub stub) {
return new JetClassBody(stub, JetStubElementTypes.CLASS_BODY);
}
@Override
public PsiJetClassBodyStub createStub(@NotNull JetClassBody psi, StubElement parentStub) {
return new PsiJetClassBodyStubImpl(parentStub, JetStubElementTypes.CLASS_BODY);
}
@Override
public void serialize(@NotNull PsiJetClassBodyStub stub, @NotNull StubOutputStream dataStream) throws IOException {
//do nothing;
}
@NotNull
@Override
public PsiJetClassBodyStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
return new PsiJetClassBodyStubImpl(parentStub, JetStubElementTypes.CLASS_BODY);
}
@Override
public void indexStub(@NotNull PsiJetClassBodyStub stub, @NotNull IndexSink sink) {
//do nothing
}
}
@@ -31,4 +31,5 @@ public interface JetStubElementTypes {
JetTypeParameterElementType TYPE_PARAMETER = new JetTypeParameterElementType("TYPE_PARAMETER");
JetTypeParameterListElementType TYPE_PARAMETER_LIST = new JetTypeParameterListElementType("TYPE_PARAMETER_LIST");
JetAnnotationElementType ANNOTATION_ENTRY = new JetAnnotationElementType("ANNOTATION_ENTRY");
JetClassBodyElementType CLASS_BODY = new JetClassBodyElementType("CLASS_BODY");
}
@@ -0,0 +1,29 @@
/*
* Copyright 2010-2013 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.IStubElementType;
import com.intellij.psi.stubs.StubBase;
import com.intellij.psi.stubs.StubElement;
import org.jetbrains.jet.lang.psi.JetClassBody;
import org.jetbrains.jet.lang.psi.stubs.PsiJetClassBodyStub;
public class PsiJetClassBodyStubImpl extends StubBase<JetClassBody> implements PsiJetClassBodyStub {
public PsiJetClassBodyStubImpl(StubElement parent, IStubElementType elementType) {
super(parent, elementType);
}
}