diff --git a/compiler/psi/src/org/jetbrains/kotlin/KtNodeTypes.java b/compiler/psi/src/org/jetbrains/kotlin/KtNodeTypes.java index 7e3349a2deb..c10c466a7a8 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/KtNodeTypes.java +++ b/compiler/psi/src/org/jetbrains/kotlin/KtNodeTypes.java @@ -62,7 +62,7 @@ public interface KtNodeTypes { IElementType ANNOTATION_TARGET = KtStubElementTypes.ANNOTATION_TARGET; IElementType TYPE_ARGUMENT_LIST = KtStubElementTypes.TYPE_ARGUMENT_LIST; - KtNodeType VALUE_ARGUMENT_LIST = new KtNodeType("VALUE_ARGUMENT_LIST", KtValueArgumentList.class); + IElementType VALUE_ARGUMENT_LIST = KtStubElementTypes.VALUE_ARGUMENT_LIST; KtNodeType VALUE_ARGUMENT = new KtNodeType("VALUE_ARGUMENT", KtValueArgument.class); KtNodeType LAMBDA_ARGUMENT = new KtNodeType("LAMBDA_ARGUMENT", KtLambdaArgument.class); KtNodeType VALUE_ARGUMENT_NAME = new KtNodeType("VALUE_ARGUMENT_NAME", KtValueArgumentName.class); diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/KtAnnotationEntry.java b/compiler/psi/src/org/jetbrains/kotlin/psi/KtAnnotationEntry.java index fff03721fa1..9ba7306f130 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/KtAnnotationEntry.java +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/KtAnnotationEntry.java @@ -20,7 +20,6 @@ import com.intellij.lang.ASTNode; import com.intellij.psi.PsiElement; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.kotlin.KtNodeTypes; import org.jetbrains.kotlin.lexer.KtTokens; import org.jetbrains.kotlin.name.Name; import org.jetbrains.kotlin.psi.stubs.KotlinAnnotationEntryStub; @@ -64,7 +63,8 @@ public class KtAnnotationEntry extends KtElementImplStub> { public KtValueArgumentList(@NotNull ASTNode node) { super(node); } + public KtValueArgumentList(@NotNull KotlinPlaceHolderStub stub) { + super(stub, KtStubElementTypes.VALUE_ARGUMENT_LIST); + } + @Override public R accept(@NotNull KtVisitor visitor, D data) { return visitor.visitValueArgumentList(this, data); diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/KotlinStubVersions.kt b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/KotlinStubVersions.kt index b1586002825..ed7bb8d950f 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/KotlinStubVersions.kt +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/KotlinStubVersions.kt @@ -23,7 +23,7 @@ object KotlinStubVersions { // Though only kotlin declarations (no code in the bodies) are stubbed, please do increase this version // if you are not 100% sure it can be avoided. // Increasing this version will lead to reindexing of all kotlin source files on the first IDE startup with the new version. - const val SOURCE_STUB_VERSION = 127 + const val SOURCE_STUB_VERSION = 128 // Binary stub version should be increased if stub format (org.jetbrains.kotlin.psi.stubs.impl) is changed // or changes are made to the core stub building code (org.jetbrains.kotlin.idea.decompiler.stubBuilder). diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtStubElementTypes.java b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtStubElementTypes.java index c6f3d573d95..4972c420cbc 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtStubElementTypes.java +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtStubElementTypes.java @@ -101,6 +101,9 @@ public interface KtStubElementTypes { KtPlaceHolderStubElementType TYPE_ARGUMENT_LIST = new KtPlaceHolderStubElementType<>("TYPE_ARGUMENT_LIST", KtTypeArgumentList.class); + KtPlaceHolderStubElementType VALUE_ARGUMENT_LIST = + new KtValueArgumentListElementType("VALUE_ARGUMENT_LIST"); + KtPlaceHolderStubElementType SUPER_TYPE_LIST = new KtPlaceHolderStubElementType<>("SUPER_TYPE_LIST", KtSuperTypeList.class); diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtValueArgumentListElementType.java b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtValueArgumentListElementType.java new file mode 100644 index 00000000000..6f37e74235d --- /dev/null +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtValueArgumentListElementType.java @@ -0,0 +1,27 @@ +/* + * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.psi.stubs.elements; + +import com.intellij.lang.ASTNode; +import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.kotlin.psi.KtValueArgumentList; + +public class KtValueArgumentListElementType extends KtPlaceHolderStubElementType { + public KtValueArgumentListElementType(@NotNull @NonNls String debugName) { + super(debugName, KtValueArgumentList.class); + } + + @Override + public boolean shouldCreateStub(ASTNode node) { + ASTNode treeParent = node.getTreeParent(); + if (treeParent == null || treeParent.getElementType() != KtStubElementTypes.ANNOTATION_ENTRY) { + return false; + } + + return super.shouldCreateStub(node); + } +} diff --git a/idea/testData/stubs/AnnotationValues.expected b/idea/testData/stubs/AnnotationValues.expected index f250b6fe867..6b46fb4a5ea 100644 --- a/idea/testData/stubs/AnnotationValues.expected +++ b/idea/testData/stubs/AnnotationValues.expected @@ -57,6 +57,7 @@ PsiJetFileStubImpl[package=test] TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION[referencedName=Simple] + VALUE_ARGUMENT_LIST CLASS[fqName=test.StringLiteral, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=true, name=StringLiteral, superNames=[]] MODIFIER_LIST[annotation] PRIMARY_CONSTRUCTOR @@ -82,6 +83,7 @@ PsiJetFileStubImpl[package=test] TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION[referencedName=StringLiteral] + VALUE_ARGUMENT_LIST CLASS[fqName=test.E, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=true, name=E, superNames=[]] MODIFIER_LIST[enum] CLASS_BODY @@ -110,6 +112,7 @@ PsiJetFileStubImpl[package=test] TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION[referencedName=EnumLiteral] + VALUE_ARGUMENT_LIST CLASS[fqName=test.VarArg, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=true, name=VarArg, superNames=[]] MODIFIER_LIST[annotation] PRIMARY_CONSTRUCTOR @@ -126,6 +129,7 @@ PsiJetFileStubImpl[package=test] TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION[referencedName=VarArg] + VALUE_ARGUMENT_LIST CLASS[fqName=test.Arrays, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=true, name=Arrays, superNames=[]] MODIFIER_LIST[annotation] PRIMARY_CONSTRUCTOR @@ -161,6 +165,7 @@ PsiJetFileStubImpl[package=test] TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION[referencedName=Arrays] + VALUE_ARGUMENT_LIST CLASS[fqName=test.ClassLiteral, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=true, name=ClassLiteral, superNames=[]] MODIFIER_LIST[annotation] PRIMARY_CONSTRUCTOR @@ -190,6 +195,7 @@ PsiJetFileStubImpl[package=test] TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION[referencedName=ClassLiteral] + VALUE_ARGUMENT_LIST TYPE_PARAMETER_LIST TYPE_PARAMETER[fqName=null, isInVariance=false, isOutVariance=false, name=T] CLASS[fqName=test.Nested, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=true, name=Nested, superNames=[]] @@ -223,3 +229,4 @@ PsiJetFileStubImpl[package=test] TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION[referencedName=Outer] + VALUE_ARGUMENT_LIST diff --git a/idea/testData/stubs/AnnotationWithValue.expected b/idea/testData/stubs/AnnotationWithValue.expected index 1f0e13c3656..cdba1e5f673 100644 --- a/idea/testData/stubs/AnnotationWithValue.expected +++ b/idea/testData/stubs/AnnotationWithValue.expected @@ -20,3 +20,4 @@ PsiJetFileStubImpl[package=] TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION[referencedName=Test] + VALUE_ARGUMENT_LIST diff --git a/idea/testData/stubs/Contracts.expected b/idea/testData/stubs/Contracts.expected index 8740306f432..1dda856666b 100644 --- a/idea/testData/stubs/Contracts.expected +++ b/idea/testData/stubs/Contracts.expected @@ -6,6 +6,7 @@ PsiJetFileStubImpl[package=test] TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION[referencedName=Suppress] + VALUE_ARGUMENT_LIST PACKAGE_DIRECTIVE REFERENCE_EXPRESSION[referencedName=test] IMPORT_LIST diff --git a/idea/testData/stubs/DynamicType.expected b/idea/testData/stubs/DynamicType.expected index ba0b188bec6..308e7e46243 100644 --- a/idea/testData/stubs/DynamicType.expected +++ b/idea/testData/stubs/DynamicType.expected @@ -34,3 +34,4 @@ PsiJetFileStubImpl[package=] TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION[referencedName=Target] + VALUE_ARGUMENT_LIST diff --git a/idea/testData/stubs/TypeAnnotation.expected b/idea/testData/stubs/TypeAnnotation.expected index 14227ecdc18..be60e5cac06 100644 --- a/idea/testData/stubs/TypeAnnotation.expected +++ b/idea/testData/stubs/TypeAnnotation.expected @@ -33,6 +33,7 @@ PsiJetFileStubImpl[package=] TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION[referencedName=b] + VALUE_ARGUMENT_LIST USER_TYPE REFERENCE_EXPRESSION[referencedName=DoubleRange] TYPE_REFERENCE @@ -49,5 +50,6 @@ PsiJetFileStubImpl[package=] TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION[referencedName=b] + VALUE_ARGUMENT_LIST USER_TYPE REFERENCE_EXPRESSION[referencedName=Unit]