UAST: remove redundant override: expression list's evaluate()
The super function in `KotlinEvaluatableUElement` is almost same, except for handling of `UnsignedErrorValueTypeConstant`. Such handling was added later, so I assume the addition to this override was missed. In any cases, this override is unnecessary.
This commit is contained in:
committed by
Ilya Kirillov
parent
31d1c002c5
commit
2e58b57db9
+6
-15
@@ -17,9 +17,6 @@
|
|||||||
package org.jetbrains.uast.kotlin
|
package org.jetbrains.uast.kotlin
|
||||||
|
|
||||||
import com.intellij.psi.PsiElement
|
import com.intellij.psi.PsiElement
|
||||||
import org.jetbrains.kotlin.psi.KtExpression
|
|
||||||
import org.jetbrains.kotlin.resolve.BindingContext
|
|
||||||
import org.jetbrains.kotlin.types.TypeUtils
|
|
||||||
import org.jetbrains.uast.UElement
|
import org.jetbrains.uast.UElement
|
||||||
import org.jetbrains.uast.UExpression
|
import org.jetbrains.uast.UExpression
|
||||||
import org.jetbrains.uast.UExpressionList
|
import org.jetbrains.uast.UExpressionList
|
||||||
@@ -27,23 +24,17 @@ import org.jetbrains.uast.UastSpecialExpressionKind
|
|||||||
import org.jetbrains.uast.kotlin.kinds.KotlinSpecialExpressionKinds
|
import org.jetbrains.uast.kotlin.kinds.KotlinSpecialExpressionKinds
|
||||||
|
|
||||||
open class KotlinUExpressionList(
|
open class KotlinUExpressionList(
|
||||||
override val sourcePsi: PsiElement?,
|
override val sourcePsi: PsiElement?,
|
||||||
override val kind: UastSpecialExpressionKind, // original element
|
override val kind: UastSpecialExpressionKind, // original element
|
||||||
givenParent: UElement?
|
givenParent: UElement?
|
||||||
) : KotlinAbstractUExpression(givenParent), UExpressionList, KotlinUElementWithType, KotlinEvaluatableUElement {
|
) : KotlinAbstractUExpression(givenParent), UExpressionList, KotlinUElementWithType, KotlinEvaluatableUElement {
|
||||||
override lateinit var expressions: List<UExpression>
|
override lateinit var expressions: List<UExpression>
|
||||||
internal set
|
internal set
|
||||||
|
|
||||||
override fun evaluate(): Any? {
|
|
||||||
val ktElement = sourcePsi as? KtExpression ?: return null
|
|
||||||
val compileTimeConst = ktElement.analyze()[BindingContext.COMPILE_TIME_VALUE, ktElement]
|
|
||||||
return compileTimeConst?.getValue(TypeUtils.NO_EXPECTED_TYPE)
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun createClassBody(psi: PsiElement?, uastParent: UElement?): KotlinUExpressionList =
|
fun createClassBody(psi: PsiElement?, uastParent: UElement?): KotlinUExpressionList =
|
||||||
KotlinUExpressionList(psi, KotlinSpecialExpressionKinds.CLASS_BODY, uastParent).apply {
|
KotlinUExpressionList(psi, KotlinSpecialExpressionKinds.CLASS_BODY, uastParent).apply {
|
||||||
expressions = emptyList()
|
expressions = emptyList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user