Andrey
04/29/2024, 7:38 AMvisitClassNew
, is it possible to get control of the latter? I understand that the code logic itself should be written so that it is not important, but what if I want to change the name of a function that was generated by another plugin?Tóth István Zoltán
04/29/2024, 9:51 AMvisitClassNew
is probably quite deep in the plugin code, what you have to consider is the execution order of the plugin extensions. Which I don't know to be honest, but I guess it is the order the plugins are passed to the compiler.Andrey
05/01/2024, 9:05 AMoverride fun visitFunctionNew(declaration: IrFunction): IrStatement {
if (declaration.name.asString() == "test") {
declaration.name = Name.identifier("test_fix")
}
return super.visitFunctionNew(declaration)
}
It works great for the JVM implementation and passes the tests
I get something like
@NotNull
public final String test_fix() {
return "test";
}
When using already in Kotlin native, I get an error that says that my Descriptor and Ir contradict each other
Compilation failed: FULL: FUN name:fix_test visibility:public modality:FINAL <> () returnType:kotlin.Unit
Ir: kotlin.native#fix_test(){}
Descriptor: kotlin.native#test(){}
Andrey
05/01/2024, 9:10 AMvar
variables described in the abstract class IrFunction
While the descriptor is marked as val
, I couldn't find any builders to help change thisTóth István Zoltán
05/02/2024, 3:09 AMAndrey
05/02/2024, 7:27 AMTóth István Zoltán
05/02/2024, 7:43 AMAndrey
05/02/2024, 7:45 AMTóth István Zoltán
05/02/2024, 8:41 AMAndrey
05/02/2024, 8:49 AMTóth István Zoltán
05/02/2024, 9:57 AMAndrey
05/02/2024, 10:20 AMAndrey
05/02/2024, 11:29 AMAndrey
05/03/2024, 9:07 AMoverride fun visitSimpleFunction(declaration: IrSimpleFunction): IrStatement {
if (declaration.name.asString() == "test") {
declaration.name = Name.identifier("test_fix")
}
return super.visitSimpleFunction(declaration)
}