From 8c7269ea9a7a40e509d57f946eebf3602a1fadcb Mon Sep 17 00:00:00 2001 From: Nicolay Mitropolsky Date: Tue, 6 Feb 2018 19:06:49 +0300 Subject: [PATCH] 172: KotlinUCollectionLiteralExpression: remove override modifier --- .../KotlinUCollectionLiteralExpression.kt.172 | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUCollectionLiteralExpression.kt.172 diff --git a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUCollectionLiteralExpression.kt.172 b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUCollectionLiteralExpression.kt.172 new file mode 100644 index 00000000000..f2b14e0d8a0 --- /dev/null +++ b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUCollectionLiteralExpression.kt.172 @@ -0,0 +1,54 @@ +/* + * Copyright 2000-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.uast.kotlin.expressions + +import com.intellij.psi.PsiArrayType +import com.intellij.psi.PsiElement +import com.intellij.psi.PsiMethod +import com.intellij.psi.PsiType +import org.jetbrains.kotlin.psi.KtCollectionLiteralExpression +import org.jetbrains.uast.* +import org.jetbrains.uast.kotlin.KotlinAbstractUExpression +import org.jetbrains.uast.kotlin.KotlinConverter +import org.jetbrains.uast.kotlin.KotlinUElementWithType + +class KotlinUCollectionLiteralExpression( + val sourcePsi: KtCollectionLiteralExpression, + givenParent: UElement? +) : KotlinAbstractUExpression(givenParent), UCallExpression, KotlinUElementWithType { + + override val classReference: UReferenceExpression? get() = null + + override val kind: UastCallKind = UastCallKind.NESTED_ARRAY_INITIALIZER + + override val methodIdentifier: UIdentifier? by lazy { UIdentifier(sourcePsi.leftBracket, this) } + + override val methodName: String? get() = null + + override val receiver: UExpression? get() = null + + override val receiverType: PsiType? get() = null + + override val returnType: PsiType? get() = getExpressionType() + + override val typeArgumentCount: Int get() = typeArguments.size + + override val typeArguments: List get() = listOfNotNull((returnType as? PsiArrayType)?.componentType) + + override val valueArgumentCount: Int + get() = sourcePsi.getInnerExpressions().size + + override val valueArguments by lazy { + sourcePsi.getInnerExpressions().map { KotlinConverter.convertOrEmpty(it, this) } + } + + override fun asRenderString(): String = "collectionLiteral[" + valueArguments.joinToString { it.asRenderString() } + "]" + + override fun resolve(): PsiMethod? = null + + override val psi: PsiElement get() = sourcePsi + +} \ No newline at end of file