Put arguments name to stubs in annotations (KT-23738)

This commit is contained in:
Nikolay Krasko
2018-10-15 13:12:58 +03:00
parent 12f127d631
commit d9bc512556
6 changed files with 26 additions and 3 deletions
@@ -65,7 +65,7 @@ public interface KtNodeTypes {
IElementType VALUE_ARGUMENT_LIST = KtStubElementTypes.VALUE_ARGUMENT_LIST; IElementType VALUE_ARGUMENT_LIST = KtStubElementTypes.VALUE_ARGUMENT_LIST;
IElementType VALUE_ARGUMENT = KtStubElementTypes.VALUE_ARGUMENT; IElementType VALUE_ARGUMENT = KtStubElementTypes.VALUE_ARGUMENT;
IElementType LAMBDA_ARGUMENT = KtStubElementTypes.LAMBDA_ARGUMENT; IElementType LAMBDA_ARGUMENT = KtStubElementTypes.LAMBDA_ARGUMENT;
KtNodeType VALUE_ARGUMENT_NAME = new KtNodeType("VALUE_ARGUMENT_NAME", KtValueArgumentName.class); IElementType VALUE_ARGUMENT_NAME = KtStubElementTypes.VALUE_ARGUMENT_NAME;
IElementType TYPE_REFERENCE = KtStubElementTypes.TYPE_REFERENCE; IElementType TYPE_REFERENCE = KtStubElementTypes.TYPE_REFERENCE;
IElementType USER_TYPE = KtStubElementTypes.USER_TYPE; IElementType USER_TYPE = KtStubElementTypes.USER_TYPE;
@@ -20,12 +20,18 @@ import com.intellij.lang.ASTNode;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.KtNodeTypes; import org.jetbrains.kotlin.KtNodeTypes;
import org.jetbrains.kotlin.name.Name; import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.psi.stubs.KotlinPlaceHolderStub;
import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes;
public class KtValueArgumentName extends KtElementImpl implements ValueArgumentName { public class KtValueArgumentName extends KtElementImplStub<KotlinPlaceHolderStub<KtValueArgumentName>> implements ValueArgumentName {
public KtValueArgumentName(@NotNull ASTNode node) { public KtValueArgumentName(@NotNull ASTNode node) {
super(node); super(node);
} }
public KtValueArgumentName(@NotNull KotlinPlaceHolderStub<KtValueArgumentName> stub) {
super(stub, KtStubElementTypes.VALUE_ARGUMENT_NAME);
}
@Override @Override
@NotNull @NotNull
public KtSimpleNameExpression getReferenceExpression() { public KtSimpleNameExpression getReferenceExpression() {
@@ -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 = 129 const val SOURCE_STUB_VERSION = 130
// 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).
@@ -110,6 +110,9 @@ public interface KtStubElementTypes {
KtPlaceHolderStubElementType<KtLambdaArgument> LAMBDA_ARGUMENT = KtPlaceHolderStubElementType<KtLambdaArgument> LAMBDA_ARGUMENT =
new KtPlaceHolderStubElementType<>("LAMBDA_ARGUMENT", KtLambdaArgument.class); new KtPlaceHolderStubElementType<>("LAMBDA_ARGUMENT", KtLambdaArgument.class);
KtPlaceHolderStubElementType<KtValueArgumentName> VALUE_ARGUMENT_NAME =
new KtPlaceHolderStubElementType<>("VALUE_ARGUMENT_NAME", KtValueArgumentName.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);
+12
View File
@@ -63,9 +63,17 @@ PsiJetFileStubImpl[package=test]
VALUE_ARGUMENT VALUE_ARGUMENT
VALUE_ARGUMENT VALUE_ARGUMENT
VALUE_ARGUMENT VALUE_ARGUMENT
VALUE_ARGUMENT_NAME
REFERENCE_EXPRESSION[referencedName=f]
VALUE_ARGUMENT VALUE_ARGUMENT
VALUE_ARGUMENT_NAME
REFERENCE_EXPRESSION[referencedName=c]
VALUE_ARGUMENT VALUE_ARGUMENT
VALUE_ARGUMENT_NAME
REFERENCE_EXPRESSION[referencedName=b1]
VALUE_ARGUMENT VALUE_ARGUMENT
VALUE_ARGUMENT_NAME
REFERENCE_EXPRESSION[referencedName=b2]
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
@@ -128,6 +136,8 @@ PsiJetFileStubImpl[package=test]
REFERENCE_EXPRESSION[referencedName=E1] REFERENCE_EXPRESSION[referencedName=E1]
VALUE_ARGUMENT VALUE_ARGUMENT
VALUE_ARGUMENT VALUE_ARGUMENT
VALUE_ARGUMENT_NAME
REFERENCE_EXPRESSION[referencedName=e3]
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
@@ -259,3 +269,5 @@ PsiJetFileStubImpl[package=test]
VALUE_ARGUMENT_LIST VALUE_ARGUMENT_LIST
VALUE_ARGUMENT VALUE_ARGUMENT
VALUE_ARGUMENT VALUE_ARGUMENT
VALUE_ARGUMENT_NAME
REFERENCE_EXPRESSION[referencedName=nested]
+2
View File
@@ -23,3 +23,5 @@ PsiJetFileStubImpl[package=]
VALUE_ARGUMENT_LIST VALUE_ARGUMENT_LIST
VALUE_ARGUMENT VALUE_ARGUMENT
VALUE_ARGUMENT VALUE_ARGUMENT
VALUE_ARGUMENT_NAME
REFERENCE_EXPRESSION[referencedName=other]