Hi, how do I convert `FirFunctionSymbol` to `IrFun...
# compiler
m
Hi, how do I convert
FirFunctionSymbol
to
IrFunctionSymbol
,
FirClassSymbol
to
IrClassSymbol
and so on?
d
It is quite complex process, implemented in fir2ir subsystem, and it's not exposed to plugin API What exactly do you want to do?
m
I try to convert my compiler plugin from k1 to k2. I used
DescriptorBasedReferenceSymbolTableExtension
to convert the descriptor's I collected in frontend to their IR representations in the backend.
d
If you need to map declarations, generated by your own using
FirDeclarationGenerationExtension
, you can use
FirDeclarationOrigin.Plugin
and
IrDeclarationOrigin.GeneratedByPlugin
(
GeneratedDeclarationKey
passed to first transfers to the second) For other declarations there is no simple solution Classes can be mapped by
classId
Other declarations should be mapped by signatures manually
m
I only map other declarations. Is there a good way to compare fir and ir signatures? Also how do I map
ConeKotlinType
to
IrType?
I saw that I can reference
IrElement
's by their
IdSignature
via
ReferenceSymbolTable
. Is there a way to get a
IdSignature
from an
FirElement
?
d
There is a
FirBasedSignatureComposer
m
But this wouldn't work for local declarations right?
And what about
ConeKotlinType
to
IrType
?
d
But this wouldn't work for local declarations right?
Yes, it wouldn't
And what about
ConeKotlinType
to
IrType
?
This conversion is also unavailable outside fir2ir
m
Okay thanks