I'm trying to create a `IrConstructorCall` that ca...
# compiler
a
I'm trying to create a
IrConstructorCall
that calls the constructor of an annotation. I need to reference an enum entry, but I'm unsure how to do so. Strings were easy enough using
toIrConst
but I don't see how I should be getting enum entries. Does anyone have any pointers?
a
I don't think you really want to make a constructor call in IR to the create the annotation directly, instead of applying one to the declaration. Maybe look at how the kotlinx.serialization plugins does the same thing (creating the deprecated annotation as mentioned above) and see if you can adapt it to your use case (K1) https://github.com/JetBrains/kotlin/blob/ae5228c80a607ed8c391969018faaedc3bdb4961/[…]serialization/compiler/resolve/KSerializerDescriptorResolver.kt (K2) https://github.com/JetBrains/kotlin/blob/ae5228c80a607ed8c391969018faaedc3bdb4961/[…]ins/kotlinx/serialization/compiler/fir/SerializationFirUtils.kt
a
@asdf asdf That is exactly what I'm trying to do. But it looks like they are doing it in the frontend but I'm not seeing how I can generate a constructor with an annotation there. So I was doing it in the backend
But I see
replaceAnnotations
now