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 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;
|
||||
|
||||
|
||||
@@ -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<KtLambdaArgument>) : super(stub, KtStubElementTypes.LAMBDA_ARGUMENT) {}
|
||||
|
||||
override fun getLambdaExpression(): KtLambdaExpression? = getArgumentExpression()?.unpackFunctionLiteral()
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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<KotlinPlaceHolderStub<? extends KtValueArgument>> implements ValueArgument {
|
||||
public KtValueArgument(@NotNull ASTNode 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
|
||||
public <R, D> R accept(@NotNull KtVisitor<R, D> visitor, D data) {
|
||||
return visitor.visitArgument(this, data);
|
||||
|
||||
@@ -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<KotlinPlaceHolderStub
|
||||
|
||||
@NotNull
|
||||
public List<KtValueArgument> getArguments() {
|
||||
return findChildrenByType(KtNodeTypes.VALUE_ARGUMENT);
|
||||
return getStubOrPsiChildrenAsList(KtStubElementTypes.VALUE_ARGUMENT);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -104,6 +104,12 @@ public interface KtStubElementTypes {
|
||||
KtPlaceHolderStubElementType<KtValueArgumentList> 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 =
|
||||
new KtPlaceHolderStubElementType<>("SUPER_TYPE_LIST", KtSuperTypeList.class);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user