blob: 7a87b27ce2906b061f978368b0bd31b7dc027cbf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.uast.kotlin
import com.intellij.psi.PsiMethod
import org.jetbrains.annotations.ApiStatus
import org.jetbrains.kotlin.lexer.KtTokens
import org.jetbrains.kotlin.psi.KtPostfixExpression
import org.jetbrains.uast.*
import org.jetbrains.uast.kotlin.internal.DelegatedMultiResolve
@ApiStatus.Internal
class KotlinUPostfixExpression(
override val sourcePsi: KtPostfixExpression,
givenParent: UElement?
) : KotlinAbstractUExpression(givenParent), UPostfixExpression, KotlinUElementWithType, KotlinEvaluatableUElement,
UResolvable, DelegatedMultiResolve {
override val operand by lz {
baseResolveProviderService.baseKotlinConverter.convertOrEmpty(sourcePsi.baseExpression, this)
}
override val operator = when (sourcePsi.operationToken) {
KtTokens.PLUSPLUS -> UastPostfixOperator.INC
KtTokens.MINUSMINUS -> UastPostfixOperator.DEC
KtTokens.EXCLEXCL -> KotlinPostfixOperators.EXCLEXCL
else -> UastPostfixOperator.UNKNOWN
}
override val operatorIdentifier: UIdentifier
get() = KotlinUIdentifier(sourcePsi.operationReference, this)
override fun resolveOperator(): PsiMethod? =
baseResolveProviderService.resolveCall(sourcePsi)
override fun resolve(): PsiMethod? = when (sourcePsi.operationToken) {
KtTokens.EXCLEXCL -> operand.tryResolve() as? PsiMethod
else -> null
}
}
|