16
16
17
17
package org.jetbrains.uast.kotlin.declarations
18
18
19
+ import com.intellij.psi.PsiMethod
20
+ import com.intellij.psi.PsiNameIdentifierOwner
19
21
import org.jetbrains.kotlin.asJava.elements.KtLightElement
20
22
import org.jetbrains.kotlin.asJava.elements.KtLightMethod
21
23
import org.jetbrains.kotlin.asJava.elements.KtLightMethodImpl
@@ -24,17 +26,30 @@ import org.jetbrains.kotlin.psi.KtCallableDeclaration
24
26
import org.jetbrains.kotlin.psi.KtFunction
25
27
import org.jetbrains.kotlin.psi.KtParameter
26
28
import org.jetbrains.uast.*
27
- import org.jetbrains.uast.java.JavaUMethod
29
+ import org.jetbrains.uast.java.JavaUAnnotation
30
+ import org.jetbrains.uast.java.annotations
31
+ import org.jetbrains.uast.java.internal.JavaUElementWithComments
32
+ import org.jetbrains.uast.kotlin.KotlinUParameter
28
33
import org.jetbrains.uast.kotlin.lz
29
34
import org.jetbrains.uast.kotlin.unwrap
30
35
31
36
open class KotlinUMethod (
32
37
psi : KtLightMethod ,
33
- containingElement : UElement ?
34
- ) : JavaUMethod(psi, containingElement) {
38
+ override val containingElement : UElement ?
39
+ ) : UMethod, JavaUElementWithComments, PsiMethod by psi {
35
40
override val psi: KtLightMethod = unwrap<UMethod , KtLightMethod >(psi)
36
41
private val kotlinOrigin = (psi.originalElement as KtLightElement <* , * >).kotlinOrigin
37
42
43
+ override val annotations by lz { psi.annotations.map { JavaUAnnotation (it, this ) } }
44
+
45
+ override val uastParameters by lz {
46
+ psi.parameterList.parameters.map { KotlinUParameter (it, this ) }
47
+ }
48
+
49
+ override val uastAnchor: UElement
50
+ get() = UIdentifier ((psi.originalElement as ? PsiNameIdentifierOwner )?.nameIdentifier ? : psi.nameIdentifier, this )
51
+
52
+
38
53
override val uastBody by lz {
39
54
val bodyExpression = (kotlinOrigin as ? KtFunction )?.bodyExpression ? : return @lz null
40
55
getLanguagePlugin().convertElement(bodyExpression, this ) as ? UExpression
0 commit comments