Does anyone know how i can reference a `IrFunction...
# compiler
j
Does anyone know how i can reference a
IrFunctionAccessExpression
value parameter for use in another expression? I keep being told I am creating the const or getter twice when i am modifying a function body
I am trying to add an IrCall if a statement is for a certain symbol
This is the exception thrown
s
Try
.deepCopyWithSymbols()
My guess is that every element in IR should be referentially unique, function above will create a copy of it
Alternatively, you can create a temp variable with the value and
irGet
that. It will also prevent executing the value parameter expression twicd
j
the first option passed the build. now need to test it. How would i do the second option?
you have been really helpful btw, thank you
s
Check
irTemporary
or something like that, don't remember the exact name It is fairly simple, you just add that as a statement with correct initial value and then create your own
irGet
referencing that temporary variable
j
thanks i'll try it all out and get back to you. thanks again!
r
irTemporary
is only available in certain builder scopes (IrBlockBody I think), but you can usually create a temp variable anyways using the Impl class
s
Yep, I think the code above uses blockBody anyway :)
j
thanks for the info! looking into it after a meeting