From 927b1971de69b80203e9fb04a0fb3412c6c819c8 Mon Sep 17 00:00:00 2001 From: "Pavel V. Talanov" Date: Fri, 28 Mar 2014 19:18:14 +0400 Subject: [PATCH] Stub for JetDotQualifiedExpression --- .../src/org/jetbrains/jet/JetNodeTypes.java | 3 +- .../lang/psi/JetDotQualifiedExpression.java | 10 ++++-- .../JetDotQualifiedExpressionElementType.java | 35 +++++++++++++++++++ .../stubs/elements/JetStubElementTypes.java | 1 + 4 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetDotQualifiedExpressionElementType.java diff --git a/compiler/frontend/src/org/jetbrains/jet/JetNodeTypes.java b/compiler/frontend/src/org/jetbrains/jet/JetNodeTypes.java index 029d5072b55..687e436dfee 100644 --- a/compiler/frontend/src/org/jetbrains/jet/JetNodeTypes.java +++ b/compiler/frontend/src/org/jetbrains/jet/JetNodeTypes.java @@ -19,7 +19,6 @@ package org.jetbrains.jet; import com.intellij.psi.tree.IElementType; import com.intellij.psi.tree.IFileElementType; import org.jetbrains.jet.lang.psi.*; -import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementType; import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes; import org.jetbrains.jet.plugin.JetLanguage; @@ -132,7 +131,7 @@ public interface JetNodeTypes { JetNodeType CALL_EXPRESSION = new JetNodeType("CALL_EXPRESSION", JetCallExpression.class); JetNodeType ARRAY_ACCESS_EXPRESSION = new JetNodeType("ARRAY_ACCESS_EXPRESSION", JetArrayAccessExpression.class); JetNodeType INDICES = new JetNodeType("INDICES", JetContainerNode.class); - JetNodeType DOT_QUALIFIED_EXPRESSION = new JetNodeType("DOT_QUALIFIED_EXPRESSION", JetDotQualifiedExpression.class); + IElementType DOT_QUALIFIED_EXPRESSION = JetStubElementTypes.DOT_QUALIFIED_EXPRESSION; JetNodeType CALLABLE_REFERENCE_EXPRESSION = new JetNodeType("CALLABLE_REFERENCE_EXPRESSION", JetCallableReferenceExpression.class); JetNodeType SAFE_ACCESS_EXPRESSION = new JetNodeType("SAFE_ACCESS_EXPRESSION", JetSafeQualifiedExpression.class); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetDotQualifiedExpression.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetDotQualifiedExpression.java index bcf5c0348d9..2b0a879177e 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetDotQualifiedExpression.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetDotQualifiedExpression.java @@ -17,16 +17,22 @@ package org.jetbrains.jet.lang.psi; import com.intellij.lang.ASTNode; -import com.intellij.psi.stubs.StubElement; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.jetbrains.jet.lang.psi.stubs.PsiJetPlaceHolderStub; +import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes; import org.jetbrains.jet.lexer.JetToken; -public class JetDotQualifiedExpression extends JetExpressionImplStub implements JetQualifiedExpression { +public class JetDotQualifiedExpression extends JetExpressionImplStub> + implements JetQualifiedExpression { public JetDotQualifiedExpression(@NotNull ASTNode node) { super(node); } + public JetDotQualifiedExpression(@NotNull PsiJetPlaceHolderStub stub) { + super(stub, JetStubElementTypes.DOT_QUALIFIED_EXPRESSION); + } + @Override public R accept(@NotNull JetVisitor visitor, D data) { return visitor.visitDotQualifiedExpression(this, data); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetDotQualifiedExpressionElementType.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetDotQualifiedExpressionElementType.java new file mode 100644 index 00000000000..20e8451694f --- /dev/null +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetDotQualifiedExpressionElementType.java @@ -0,0 +1,35 @@ +/* + * 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.util.PsiTreeUtil; +import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.jet.lang.psi.JetDotQualifiedExpression; +import org.jetbrains.jet.lang.psi.JetImportDirective; + +public class JetDotQualifiedExpressionElementType extends JetPlaceHolderStubElementType { + public JetDotQualifiedExpressionElementType(@NotNull @NonNls String debugName) { + super(debugName, JetDotQualifiedExpression.class); + } + + @Override + public boolean shouldCreateStub(ASTNode node) { + return PsiTreeUtil.getParentOfType(node.getPsi(), JetImportDirective.class) != null; + } +} 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 dbda8cffb28..a8bc851ae21 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 @@ -64,6 +64,7 @@ public interface JetStubElementTypes { JetUserTypeElementType USER_TYPE = new JetUserTypeElementType("USER_TYPE"); JetNameReferenceExpressionElementType REFERENCE_EXPRESSION = new JetNameReferenceExpressionElementType("REFERENCE_EXPRESSION"); + JetDotQualifiedExpressionElementType DOT_QUALIFIED_EXPRESSION = new JetDotQualifiedExpressionElementType("DOT_QUALIFIED_EXPRESSION"); JetPlaceHolderStubElementType TYPE_ARGUMENT_LIST = new JetPlaceHolderStubElementType("TYPE_ARGUMENT_LIST", JetTypeArgumentList.class);