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

Chachako

11/07/2021, 5:47 PM
How should I return multi expressions in
IrGenerationExtension.visitCall
?
Forgive me for being a little stupid. I didn’t see
Copy code
irBlock {}
s

shikasd

11/07/2021, 10:59 PM
Blocks could break the flow quite a bit, I think
IrComposite
is a bit more suitable for this use case
c

Chachako

11/08/2021, 4:21 AM
Cool, is there any difference between these two methods?
s

shikasd

11/08/2021, 12:58 PM
No real knowledge, only guessing based on my experience with blocks: it feels like blocks create some kind of scope, and sometimes result in less efficient bytecode. Composite seems to be a plain expression container, just collecting multiple expressions in a place of a single one. Both could break the code flow though if used in the wrong places, but I've seen composites used way more often for default param values and other grouping inside the compiler.
c

Chachako

11/08/2021, 1:00 PM
Detailed explanation! Thank you, I use
IrComposite
now
3 Views