https://kotlinlang.org logo
#compiler
Title
# compiler
a

Ayla

10/23/2023, 7:02 AM
Copy code
fun a(param:Int){
   val v = param
}
//transformed to
fun a(param:State<Int>){
   val v = param.value
}
To do such a transformation, I need to change the param type first. But I don't know how to handle the function body. The IR for
param
before transformation is
Get_Var
, and the after for
param.value
is
Call
, it seems I cannot directly use
visitGetValue
to do it. Is there another methods to use?
a

Artem Kobzar

10/23/2023, 7:06 AM
to visit the
param.value
you could use
visitCall
to handle
param.value
if this was the question.