I’m using Kotlin compiler to analyze kotlin source file. I need to get enclosing element that defines function of KtCallExpression
For example, If I have this in a file called Main.kt
:
fun main() {
f1()
Test.f2()
}
fun f1() {
}
class Test {
companion object {
fun f2() {
}
}
}
There would be 2 KtCallExpression
in main()
, one for f1()
and other for f2()
. How do I get File Main.kt
from f1()
? and How do I get Class Test
from f2()
?