diff --git a/compiler/psi/src/org/jetbrains/kotlin/KtNodeTypes.java b/compiler/psi/src/org/jetbrains/kotlin/KtNodeTypes.java index c10c466a7a8..ce6a9226723 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/KtNodeTypes.java +++ b/compiler/psi/src/org/jetbrains/kotlin/KtNodeTypes.java @@ -63,8 +63,8 @@ public interface KtNodeTypes { IElementType TYPE_ARGUMENT_LIST = KtStubElementTypes.TYPE_ARGUMENT_LIST; 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); + IElementType VALUE_ARGUMENT = KtStubElementTypes.VALUE_ARGUMENT; + IElementType LAMBDA_ARGUMENT = KtStubElementTypes.LAMBDA_ARGUMENT; KtNodeType VALUE_ARGUMENT_NAME = new KtNodeType("VALUE_ARGUMENT_NAME", KtValueArgumentName.class); IElementType TYPE_REFERENCE = KtStubElementTypes.TYPE_REFERENCE; diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/KtLambdaArgument.kt b/compiler/psi/src/org/jetbrains/kotlin/psi/KtLambdaArgument.kt index b3405718fbc..bb49f747a6f 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/KtLambdaArgument.kt +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/KtLambdaArgument.kt @@ -1,26 +1,18 @@ /* - * Copyright 2010-2015 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. + * 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 import com.intellij.lang.ASTNode +import org.jetbrains.kotlin.psi.stubs.KotlinPlaceHolderStub +import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes -class KtLambdaArgument(node: ASTNode) : KtValueArgument(node), LambdaArgument { +class KtLambdaArgument : KtValueArgument, LambdaArgument { + constructor(node: ASTNode) : super(node) {} + + constructor(stub: KotlinPlaceHolderStub) : super(stub, KtStubElementTypes.LAMBDA_ARGUMENT) {} override fun getLambdaExpression(): KtLambdaExpression? = getArgumentExpression()?.unpackFunctionLiteral() } - - diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/KtValueArgument.java b/compiler/psi/src/org/jetbrains/kotlin/psi/KtValueArgument.java index 9703303ffc8..bfb392f2bcb 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/KtValueArgument.java +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/KtValueArgument.java @@ -23,12 +23,23 @@ 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.psi.stubs.KotlinPlaceHolderStub; +import org.jetbrains.kotlin.psi.stubs.elements.KtPlaceHolderStubElementType; +import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes; -public class KtValueArgument extends KtElementImpl implements ValueArgument { +public class KtValueArgument extends KtElementImplStub> implements ValueArgument { public KtValueArgument(@NotNull ASTNode node) { super(node); } + public KtValueArgument(@NotNull KotlinPlaceHolderStub stub) { + super(stub, KtStubElementTypes.VALUE_ARGUMENT); + } + + protected KtValueArgument(KotlinPlaceHolderStub stub, KtPlaceHolderStubElementType nodeType) { + super(stub, nodeType); + } + @Override public R accept(@NotNull KtVisitor visitor, D data) { return visitor.visitArgument(this, data); diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/KtValueArgumentList.java b/compiler/psi/src/org/jetbrains/kotlin/psi/KtValueArgumentList.java index 0bec2dd06b5..99b244e3592 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/KtValueArgumentList.java +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/KtValueArgumentList.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.psi.stubs.KotlinPlaceHolderStub; import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes; @@ -43,7 +42,7 @@ public class KtValueArgumentList extends KtElementImplStub getArguments() { - return findChildrenByType(KtNodeTypes.VALUE_ARGUMENT); + return getStubOrPsiChildrenAsList(KtStubElementTypes.VALUE_ARGUMENT); } @Nullable 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 ed7bb8d950f..7a3650709ca 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 = 128 + const val SOURCE_STUB_VERSION = 129 // 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 4972c420cbc..9bfd1195065 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 @@ -104,6 +104,12 @@ public interface KtStubElementTypes { KtPlaceHolderStubElementType VALUE_ARGUMENT_LIST = new KtValueArgumentListElementType("VALUE_ARGUMENT_LIST"); + KtPlaceHolderStubElementType VALUE_ARGUMENT = + new KtPlaceHolderStubElementType<>("VALUE_ARGUMENT", KtValueArgument.class); + + KtPlaceHolderStubElementType LAMBDA_ARGUMENT = + new KtPlaceHolderStubElementType<>("LAMBDA_ARGUMENT", KtLambdaArgument.class); + KtPlaceHolderStubElementType SUPER_TYPE_LIST = new KtPlaceHolderStubElementType<>("SUPER_TYPE_LIST", KtSuperTypeList.class); diff --git a/idea/testData/stubs/AnnotationValues.expected b/idea/testData/stubs/AnnotationValues.expected index 6b46fb4a5ea..0ed705e9d3c 100644 --- a/idea/testData/stubs/AnnotationValues.expected +++ b/idea/testData/stubs/AnnotationValues.expected @@ -58,6 +58,14 @@ PsiJetFileStubImpl[package=test] USER_TYPE REFERENCE_EXPRESSION[referencedName=Simple] VALUE_ARGUMENT_LIST + VALUE_ARGUMENT + VALUE_ARGUMENT + VALUE_ARGUMENT + VALUE_ARGUMENT + VALUE_ARGUMENT + VALUE_ARGUMENT + VALUE_ARGUMENT + VALUE_ARGUMENT CLASS[fqName=test.StringLiteral, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=true, name=StringLiteral, superNames=[]] MODIFIER_LIST[annotation] PRIMARY_CONSTRUCTOR @@ -84,6 +92,9 @@ PsiJetFileStubImpl[package=test] USER_TYPE REFERENCE_EXPRESSION[referencedName=StringLiteral] VALUE_ARGUMENT_LIST + VALUE_ARGUMENT + VALUE_ARGUMENT + VALUE_ARGUMENT CLASS[fqName=test.E, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=true, name=E, superNames=[]] MODIFIER_LIST[enum] CLASS_BODY @@ -113,6 +124,10 @@ PsiJetFileStubImpl[package=test] USER_TYPE REFERENCE_EXPRESSION[referencedName=EnumLiteral] VALUE_ARGUMENT_LIST + VALUE_ARGUMENT + REFERENCE_EXPRESSION[referencedName=E1] + VALUE_ARGUMENT + VALUE_ARGUMENT CLASS[fqName=test.VarArg, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=true, name=VarArg, superNames=[]] MODIFIER_LIST[annotation] PRIMARY_CONSTRUCTOR @@ -130,6 +145,9 @@ PsiJetFileStubImpl[package=test] USER_TYPE REFERENCE_EXPRESSION[referencedName=VarArg] VALUE_ARGUMENT_LIST + VALUE_ARGUMENT + VALUE_ARGUMENT + VALUE_ARGUMENT CLASS[fqName=test.Arrays, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=true, name=Arrays, superNames=[]] MODIFIER_LIST[annotation] PRIMARY_CONSTRUCTOR @@ -166,6 +184,12 @@ PsiJetFileStubImpl[package=test] USER_TYPE REFERENCE_EXPRESSION[referencedName=Arrays] VALUE_ARGUMENT_LIST + VALUE_ARGUMENT + VALUE_ARGUMENT + VALUE_ARGUMENT + VALUE_ARGUMENT + VALUE_ARGUMENT + VALUE_ARGUMENT CLASS[fqName=test.ClassLiteral, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=true, name=ClassLiteral, superNames=[]] MODIFIER_LIST[annotation] PRIMARY_CONSTRUCTOR @@ -196,6 +220,9 @@ PsiJetFileStubImpl[package=test] USER_TYPE REFERENCE_EXPRESSION[referencedName=ClassLiteral] VALUE_ARGUMENT_LIST + VALUE_ARGUMENT + VALUE_ARGUMENT + VALUE_ARGUMENT 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=[]] @@ -230,3 +257,5 @@ PsiJetFileStubImpl[package=test] USER_TYPE REFERENCE_EXPRESSION[referencedName=Outer] VALUE_ARGUMENT_LIST + VALUE_ARGUMENT + VALUE_ARGUMENT diff --git a/idea/testData/stubs/AnnotationWithValue.expected b/idea/testData/stubs/AnnotationWithValue.expected index cdba1e5f673..ebea5f56b17 100644 --- a/idea/testData/stubs/AnnotationWithValue.expected +++ b/idea/testData/stubs/AnnotationWithValue.expected @@ -21,3 +21,5 @@ PsiJetFileStubImpl[package=] USER_TYPE REFERENCE_EXPRESSION[referencedName=Test] VALUE_ARGUMENT_LIST + VALUE_ARGUMENT + VALUE_ARGUMENT diff --git a/idea/testData/stubs/Contracts.expected b/idea/testData/stubs/Contracts.expected index 1dda856666b..a0fe0113a20 100644 --- a/idea/testData/stubs/Contracts.expected +++ b/idea/testData/stubs/Contracts.expected @@ -7,6 +7,7 @@ PsiJetFileStubImpl[package=test] USER_TYPE REFERENCE_EXPRESSION[referencedName=Suppress] VALUE_ARGUMENT_LIST + VALUE_ARGUMENT PACKAGE_DIRECTIVE REFERENCE_EXPRESSION[referencedName=test] IMPORT_LIST diff --git a/idea/testData/stubs/DynamicType.expected b/idea/testData/stubs/DynamicType.expected index 308e7e46243..388612f7a75 100644 --- a/idea/testData/stubs/DynamicType.expected +++ b/idea/testData/stubs/DynamicType.expected @@ -35,3 +35,5 @@ PsiJetFileStubImpl[package=] USER_TYPE REFERENCE_EXPRESSION[referencedName=Target] VALUE_ARGUMENT_LIST + VALUE_ARGUMENT + VALUE_ARGUMENT diff --git a/idea/testData/stubs/TypeAnnotation.expected b/idea/testData/stubs/TypeAnnotation.expected index be60e5cac06..659504dd8e6 100644 --- a/idea/testData/stubs/TypeAnnotation.expected +++ b/idea/testData/stubs/TypeAnnotation.expected @@ -34,6 +34,7 @@ PsiJetFileStubImpl[package=] USER_TYPE REFERENCE_EXPRESSION[referencedName=b] VALUE_ARGUMENT_LIST + VALUE_ARGUMENT USER_TYPE REFERENCE_EXPRESSION[referencedName=DoubleRange] TYPE_REFERENCE @@ -51,5 +52,6 @@ PsiJetFileStubImpl[package=] USER_TYPE REFERENCE_EXPRESSION[referencedName=b] VALUE_ARGUMENT_LIST + VALUE_ARGUMENT USER_TYPE REFERENCE_EXPRESSION[referencedName=Unit]