Stubbed VALUE_ARGUMENT_LIST and store it for annotations (KT-23738)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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<KotlinAnnotationEntrySt
|
||||
if (stub != null && !stub.hasValueArguments()) {
|
||||
return null;
|
||||
}
|
||||
return (KtValueArgumentList) findChildByType(KtNodeTypes.VALUE_ARGUMENT_LIST);
|
||||
|
||||
return getStubOrPsiChild(KtStubElementTypes.VALUE_ARGUMENT_LIST);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -22,14 +22,20 @@ 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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class KtValueArgumentList extends KtElementImpl {
|
||||
public class KtValueArgumentList extends KtElementImplStub<KotlinPlaceHolderStub<KtValueArgumentList>> {
|
||||
public KtValueArgumentList(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
public KtValueArgumentList(@NotNull KotlinPlaceHolderStub<KtValueArgumentList> stub) {
|
||||
super(stub, KtStubElementTypes.VALUE_ARGUMENT_LIST);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, D> R accept(@NotNull KtVisitor<R, D> visitor, D data) {
|
||||
return visitor.visitValueArgumentList(this, data);
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -101,6 +101,9 @@ public interface KtStubElementTypes {
|
||||
KtPlaceHolderStubElementType<KtTypeArgumentList> TYPE_ARGUMENT_LIST =
|
||||
new KtPlaceHolderStubElementType<>("TYPE_ARGUMENT_LIST", KtTypeArgumentList.class);
|
||||
|
||||
KtPlaceHolderStubElementType<KtValueArgumentList> VALUE_ARGUMENT_LIST =
|
||||
new KtValueArgumentListElementType("VALUE_ARGUMENT_LIST");
|
||||
|
||||
KtPlaceHolderStubElementType<KtSuperTypeList> SUPER_TYPE_LIST =
|
||||
new KtPlaceHolderStubElementType<>("SUPER_TYPE_LIST", KtSuperTypeList.class);
|
||||
|
||||
|
||||
+27
@@ -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<KtValueArgumentList> {
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -20,3 +20,4 @@ PsiJetFileStubImpl[package=]
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION[referencedName=Test]
|
||||
VALUE_ARGUMENT_LIST
|
||||
|
||||
+1
@@ -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
|
||||
|
||||
+1
@@ -34,3 +34,4 @@ PsiJetFileStubImpl[package=]
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION[referencedName=Target]
|
||||
VALUE_ARGUMENT_LIST
|
||||
|
||||
+2
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user