Declare real external symbols for overriden by synthetic function
instead of unbound Unbound symbols were throwing an exception on attempt to analyze them in the other parts of compiler and are generally incorrect
This commit is contained in:
+9
-4
@@ -56,11 +56,16 @@ interface IrBuilderExtension {
|
||||
|
||||
val BackendContext.localSymbolTable: SymbolTable
|
||||
|
||||
private fun IrClass.declareSimpleFunctionWithExternalOverrides(descriptor: FunctionDescriptor): IrSimpleFunction {
|
||||
return compilerContext.localSymbolTable.declareSimpleFunction(startOffset, endOffset, SERIALIZABLE_PLUGIN_ORIGIN, descriptor).also {f ->
|
||||
descriptor.overriddenDescriptors.mapTo(f.overriddenSymbols) {
|
||||
compilerContext.externalSymbols.referenceSimpleFunction(it.original)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun IrClass.contributeFunction(descriptor: FunctionDescriptor, fromStubs: Boolean = false, bodyGen: IrBlockBodyBuilder.(IrFunction) -> Unit) {
|
||||
val f: IrSimpleFunction = if (!fromStubs) compilerContext.localSymbolTable.declareSimpleFunctionWithOverrides(
|
||||
this.startOffset,
|
||||
this.endOffset,
|
||||
SERIALIZABLE_PLUGIN_ORIGIN,
|
||||
val f: IrSimpleFunction = if (!fromStubs) declareSimpleFunctionWithExternalOverrides(
|
||||
descriptor
|
||||
) else compilerContext.externalSymbols.referenceSimpleFunction(descriptor).owner
|
||||
f.parent = this
|
||||
|
||||
Reference in New Issue
Block a user