Add stub for annotations value arguments (KT-23738)
This commit is contained in:
@@ -63,8 +63,8 @@ public interface KtNodeTypes {
|
|||||||
|
|
||||||
IElementType TYPE_ARGUMENT_LIST = KtStubElementTypes.TYPE_ARGUMENT_LIST;
|
IElementType TYPE_ARGUMENT_LIST = KtStubElementTypes.TYPE_ARGUMENT_LIST;
|
||||||
IElementType VALUE_ARGUMENT_LIST = KtStubElementTypes.VALUE_ARGUMENT_LIST;
|
IElementType VALUE_ARGUMENT_LIST = KtStubElementTypes.VALUE_ARGUMENT_LIST;
|
||||||
KtNodeType VALUE_ARGUMENT = new KtNodeType("VALUE_ARGUMENT", KtValueArgument.class);
|
IElementType VALUE_ARGUMENT = KtStubElementTypes.VALUE_ARGUMENT;
|
||||||
KtNodeType LAMBDA_ARGUMENT = new KtNodeType("LAMBDA_ARGUMENT", KtLambdaArgument.class);
|
IElementType LAMBDA_ARGUMENT = KtStubElementTypes.LAMBDA_ARGUMENT;
|
||||||
KtNodeType VALUE_ARGUMENT_NAME = new KtNodeType("VALUE_ARGUMENT_NAME", KtValueArgumentName.class);
|
KtNodeType VALUE_ARGUMENT_NAME = new KtNodeType("VALUE_ARGUMENT_NAME", KtValueArgumentName.class);
|
||||||
IElementType TYPE_REFERENCE = KtStubElementTypes.TYPE_REFERENCE;
|
IElementType TYPE_REFERENCE = KtStubElementTypes.TYPE_REFERENCE;
|
||||||
|
|
||||||
|
|||||||
@@ -1,26 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2015 JetBrains s.r.o.
|
* 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.
|
||||||
* 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.kotlin.psi
|
package org.jetbrains.kotlin.psi
|
||||||
|
|
||||||
import com.intellij.lang.ASTNode
|
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<KtLambdaArgument>) : super(stub, KtStubElementTypes.LAMBDA_ARGUMENT) {}
|
||||||
|
|
||||||
override fun getLambdaExpression(): KtLambdaExpression? = getArgumentExpression()?.unpackFunctionLiteral()
|
override fun getLambdaExpression(): KtLambdaExpression? = getArgumentExpression()?.unpackFunctionLiteral()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,12 +23,23 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.kotlin.KtNodeTypes;
|
import org.jetbrains.kotlin.KtNodeTypes;
|
||||||
import org.jetbrains.kotlin.lexer.KtTokens;
|
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<KotlinPlaceHolderStub<? extends KtValueArgument>> implements ValueArgument {
|
||||||
public KtValueArgument(@NotNull ASTNode node) {
|
public KtValueArgument(@NotNull ASTNode node) {
|
||||||
super(node);
|
super(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public KtValueArgument(@NotNull KotlinPlaceHolderStub<KtValueArgument> stub) {
|
||||||
|
super(stub, KtStubElementTypes.VALUE_ARGUMENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected KtValueArgument(KotlinPlaceHolderStub<? extends KtValueArgument> stub, KtPlaceHolderStubElementType<?> nodeType) {
|
||||||
|
super(stub, nodeType);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <R, D> R accept(@NotNull KtVisitor<R, D> visitor, D data) {
|
public <R, D> R accept(@NotNull KtVisitor<R, D> visitor, D data) {
|
||||||
return visitor.visitArgument(this, data);
|
return visitor.visitArgument(this, data);
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import com.intellij.lang.ASTNode;
|
|||||||
import com.intellij.psi.PsiElement;
|
import com.intellij.psi.PsiElement;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.kotlin.KtNodeTypes;
|
|
||||||
import org.jetbrains.kotlin.lexer.KtTokens;
|
import org.jetbrains.kotlin.lexer.KtTokens;
|
||||||
import org.jetbrains.kotlin.psi.stubs.KotlinPlaceHolderStub;
|
import org.jetbrains.kotlin.psi.stubs.KotlinPlaceHolderStub;
|
||||||
import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes;
|
import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes;
|
||||||
@@ -43,7 +42,7 @@ public class KtValueArgumentList extends KtElementImplStub<KotlinPlaceHolderStub
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public List<KtValueArgument> getArguments() {
|
public List<KtValueArgument> getArguments() {
|
||||||
return findChildrenByType(KtNodeTypes.VALUE_ARGUMENT);
|
return getStubOrPsiChildrenAsList(KtStubElementTypes.VALUE_ARGUMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ object KotlinStubVersions {
|
|||||||
// Though only kotlin declarations (no code in the bodies) are stubbed, please do increase this version
|
// 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.
|
// 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.
|
// 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
|
// 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).
|
// or changes are made to the core stub building code (org.jetbrains.kotlin.idea.decompiler.stubBuilder).
|
||||||
|
|||||||
@@ -104,6 +104,12 @@ public interface KtStubElementTypes {
|
|||||||
KtPlaceHolderStubElementType<KtValueArgumentList> VALUE_ARGUMENT_LIST =
|
KtPlaceHolderStubElementType<KtValueArgumentList> VALUE_ARGUMENT_LIST =
|
||||||
new KtValueArgumentListElementType("VALUE_ARGUMENT_LIST");
|
new KtValueArgumentListElementType("VALUE_ARGUMENT_LIST");
|
||||||
|
|
||||||
|
KtPlaceHolderStubElementType<KtValueArgument> VALUE_ARGUMENT =
|
||||||
|
new KtPlaceHolderStubElementType<>("VALUE_ARGUMENT", KtValueArgument.class);
|
||||||
|
|
||||||
|
KtPlaceHolderStubElementType<KtLambdaArgument> LAMBDA_ARGUMENT =
|
||||||
|
new KtPlaceHolderStubElementType<>("LAMBDA_ARGUMENT", KtLambdaArgument.class);
|
||||||
|
|
||||||
KtPlaceHolderStubElementType<KtSuperTypeList> SUPER_TYPE_LIST =
|
KtPlaceHolderStubElementType<KtSuperTypeList> SUPER_TYPE_LIST =
|
||||||
new KtPlaceHolderStubElementType<>("SUPER_TYPE_LIST", KtSuperTypeList.class);
|
new KtPlaceHolderStubElementType<>("SUPER_TYPE_LIST", KtSuperTypeList.class);
|
||||||
|
|
||||||
|
|||||||
+29
@@ -58,6 +58,14 @@ PsiJetFileStubImpl[package=test]
|
|||||||
USER_TYPE
|
USER_TYPE
|
||||||
REFERENCE_EXPRESSION[referencedName=Simple]
|
REFERENCE_EXPRESSION[referencedName=Simple]
|
||||||
VALUE_ARGUMENT_LIST
|
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=[]]
|
CLASS[fqName=test.StringLiteral, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=true, name=StringLiteral, superNames=[]]
|
||||||
MODIFIER_LIST[annotation]
|
MODIFIER_LIST[annotation]
|
||||||
PRIMARY_CONSTRUCTOR
|
PRIMARY_CONSTRUCTOR
|
||||||
@@ -84,6 +92,9 @@ PsiJetFileStubImpl[package=test]
|
|||||||
USER_TYPE
|
USER_TYPE
|
||||||
REFERENCE_EXPRESSION[referencedName=StringLiteral]
|
REFERENCE_EXPRESSION[referencedName=StringLiteral]
|
||||||
VALUE_ARGUMENT_LIST
|
VALUE_ARGUMENT_LIST
|
||||||
|
VALUE_ARGUMENT
|
||||||
|
VALUE_ARGUMENT
|
||||||
|
VALUE_ARGUMENT
|
||||||
CLASS[fqName=test.E, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=true, name=E, superNames=[]]
|
CLASS[fqName=test.E, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=true, name=E, superNames=[]]
|
||||||
MODIFIER_LIST[enum]
|
MODIFIER_LIST[enum]
|
||||||
CLASS_BODY
|
CLASS_BODY
|
||||||
@@ -113,6 +124,10 @@ PsiJetFileStubImpl[package=test]
|
|||||||
USER_TYPE
|
USER_TYPE
|
||||||
REFERENCE_EXPRESSION[referencedName=EnumLiteral]
|
REFERENCE_EXPRESSION[referencedName=EnumLiteral]
|
||||||
VALUE_ARGUMENT_LIST
|
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=[]]
|
CLASS[fqName=test.VarArg, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=true, name=VarArg, superNames=[]]
|
||||||
MODIFIER_LIST[annotation]
|
MODIFIER_LIST[annotation]
|
||||||
PRIMARY_CONSTRUCTOR
|
PRIMARY_CONSTRUCTOR
|
||||||
@@ -130,6 +145,9 @@ PsiJetFileStubImpl[package=test]
|
|||||||
USER_TYPE
|
USER_TYPE
|
||||||
REFERENCE_EXPRESSION[referencedName=VarArg]
|
REFERENCE_EXPRESSION[referencedName=VarArg]
|
||||||
VALUE_ARGUMENT_LIST
|
VALUE_ARGUMENT_LIST
|
||||||
|
VALUE_ARGUMENT
|
||||||
|
VALUE_ARGUMENT
|
||||||
|
VALUE_ARGUMENT
|
||||||
CLASS[fqName=test.Arrays, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=true, name=Arrays, superNames=[]]
|
CLASS[fqName=test.Arrays, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=true, name=Arrays, superNames=[]]
|
||||||
MODIFIER_LIST[annotation]
|
MODIFIER_LIST[annotation]
|
||||||
PRIMARY_CONSTRUCTOR
|
PRIMARY_CONSTRUCTOR
|
||||||
@@ -166,6 +184,12 @@ PsiJetFileStubImpl[package=test]
|
|||||||
USER_TYPE
|
USER_TYPE
|
||||||
REFERENCE_EXPRESSION[referencedName=Arrays]
|
REFERENCE_EXPRESSION[referencedName=Arrays]
|
||||||
VALUE_ARGUMENT_LIST
|
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=[]]
|
CLASS[fqName=test.ClassLiteral, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=true, name=ClassLiteral, superNames=[]]
|
||||||
MODIFIER_LIST[annotation]
|
MODIFIER_LIST[annotation]
|
||||||
PRIMARY_CONSTRUCTOR
|
PRIMARY_CONSTRUCTOR
|
||||||
@@ -196,6 +220,9 @@ PsiJetFileStubImpl[package=test]
|
|||||||
USER_TYPE
|
USER_TYPE
|
||||||
REFERENCE_EXPRESSION[referencedName=ClassLiteral]
|
REFERENCE_EXPRESSION[referencedName=ClassLiteral]
|
||||||
VALUE_ARGUMENT_LIST
|
VALUE_ARGUMENT_LIST
|
||||||
|
VALUE_ARGUMENT
|
||||||
|
VALUE_ARGUMENT
|
||||||
|
VALUE_ARGUMENT
|
||||||
TYPE_PARAMETER_LIST
|
TYPE_PARAMETER_LIST
|
||||||
TYPE_PARAMETER[fqName=null, isInVariance=false, isOutVariance=false, name=T]
|
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=[]]
|
CLASS[fqName=test.Nested, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=true, name=Nested, superNames=[]]
|
||||||
@@ -230,3 +257,5 @@ PsiJetFileStubImpl[package=test]
|
|||||||
USER_TYPE
|
USER_TYPE
|
||||||
REFERENCE_EXPRESSION[referencedName=Outer]
|
REFERENCE_EXPRESSION[referencedName=Outer]
|
||||||
VALUE_ARGUMENT_LIST
|
VALUE_ARGUMENT_LIST
|
||||||
|
VALUE_ARGUMENT
|
||||||
|
VALUE_ARGUMENT
|
||||||
|
|||||||
@@ -21,3 +21,5 @@ PsiJetFileStubImpl[package=]
|
|||||||
USER_TYPE
|
USER_TYPE
|
||||||
REFERENCE_EXPRESSION[referencedName=Test]
|
REFERENCE_EXPRESSION[referencedName=Test]
|
||||||
VALUE_ARGUMENT_LIST
|
VALUE_ARGUMENT_LIST
|
||||||
|
VALUE_ARGUMENT
|
||||||
|
VALUE_ARGUMENT
|
||||||
|
|||||||
+1
@@ -7,6 +7,7 @@ PsiJetFileStubImpl[package=test]
|
|||||||
USER_TYPE
|
USER_TYPE
|
||||||
REFERENCE_EXPRESSION[referencedName=Suppress]
|
REFERENCE_EXPRESSION[referencedName=Suppress]
|
||||||
VALUE_ARGUMENT_LIST
|
VALUE_ARGUMENT_LIST
|
||||||
|
VALUE_ARGUMENT
|
||||||
PACKAGE_DIRECTIVE
|
PACKAGE_DIRECTIVE
|
||||||
REFERENCE_EXPRESSION[referencedName=test]
|
REFERENCE_EXPRESSION[referencedName=test]
|
||||||
IMPORT_LIST
|
IMPORT_LIST
|
||||||
|
|||||||
+2
@@ -35,3 +35,5 @@ PsiJetFileStubImpl[package=]
|
|||||||
USER_TYPE
|
USER_TYPE
|
||||||
REFERENCE_EXPRESSION[referencedName=Target]
|
REFERENCE_EXPRESSION[referencedName=Target]
|
||||||
VALUE_ARGUMENT_LIST
|
VALUE_ARGUMENT_LIST
|
||||||
|
VALUE_ARGUMENT
|
||||||
|
VALUE_ARGUMENT
|
||||||
|
|||||||
+2
@@ -34,6 +34,7 @@ PsiJetFileStubImpl[package=]
|
|||||||
USER_TYPE
|
USER_TYPE
|
||||||
REFERENCE_EXPRESSION[referencedName=b]
|
REFERENCE_EXPRESSION[referencedName=b]
|
||||||
VALUE_ARGUMENT_LIST
|
VALUE_ARGUMENT_LIST
|
||||||
|
VALUE_ARGUMENT
|
||||||
USER_TYPE
|
USER_TYPE
|
||||||
REFERENCE_EXPRESSION[referencedName=DoubleRange]
|
REFERENCE_EXPRESSION[referencedName=DoubleRange]
|
||||||
TYPE_REFERENCE
|
TYPE_REFERENCE
|
||||||
@@ -51,5 +52,6 @@ PsiJetFileStubImpl[package=]
|
|||||||
USER_TYPE
|
USER_TYPE
|
||||||
REFERENCE_EXPRESSION[referencedName=b]
|
REFERENCE_EXPRESSION[referencedName=b]
|
||||||
VALUE_ARGUMENT_LIST
|
VALUE_ARGUMENT_LIST
|
||||||
|
VALUE_ARGUMENT
|
||||||
USER_TYPE
|
USER_TYPE
|
||||||
REFERENCE_EXPRESSION[referencedName=Unit]
|
REFERENCE_EXPRESSION[referencedName=Unit]
|
||||||
|
|||||||
Reference in New Issue
Block a user