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

hfhbd

02/29/2024, 6:26 AM
I want to generate an init block using FIR. What's the entry point to do this,
FirDeclarationGenerationExtension
? This extension contains
generateConstructors
.
d

dmitriy.novozhilov

02/29/2024, 6:35 AM
You can't do it in FIR. Use
IrGenerationExtension
instead
FirDeclarationGenerationExtension
allows to generate only declarations, which are visible to user and can be called from the user code And
init
blocks are "invisible" from this point of view
h

hfhbd

02/29/2024, 6:45 AM
Okay, thank you.