How do you build a lambda to be passed as a parame...
# compiler
y
How do you build a lambda to be passed as a parameter to an inline function? So far, I've tried to use an
IrFunctionExpressionImpl
with a function build using
context.irFactory.buildFun
but it's giving me issues about the parent. If I try to set the parent to the containing function (i.e. the function that the inline function is called from), it gives me an error saying "unexpected parent functionName". I'm guessing that there's probably something specific that I need to put for the parent but I'm not entirely sure what it is.
s
It seems to be correct, maybe add
IrDeclarationOrigin.LOCAL_FUNCTION_FOR_LAMBDA
to that generated function?
y
Nevermind I figured it out. I was basically wrapping a lambda in an Ir-generated lambda and so the parent error that I was getting was for the original lambda because it was expecting its parent to be the Ir-generated one. I fixed it just by setting the parent on the original lambda. Thankfully debugging came in helpful because it showed what the expected parent was for the function