I have a lambda with its
it
value parameter being used in its body.
foo.increase {
it + 42
}
I want to create a different lambda, and replace
increase
with it, but reusing its
body
foo.newLambda {
it + 42
}
The problem is the
it
is not in the mapper so it fails. Indeed I got issues related to the parent in the
IrReturn
when I tested it without using
it
and I did the next workaround:
this.body = declarationIrBuilder(this).irBlockBody {
for (original in originalStatements) {
val statement: IrStatement =
if (original is IrReturn) irReturn(original.value)
else original
+statement
}
}
Is there a simple way to just copy the
body
an map the parent and the value parameters? I tried
deepCopyWithSymbols
and indicating a parent but it did not work.