[Wasm] Better preserve IR types after inlining
This commit is contained in:
+1
-1
@@ -98,7 +98,7 @@ private val wrapInlineDeclarationsWithReifiedTypeParametersPhase = makeWasmModul
|
||||
|
||||
private val functionInliningPhase = makeCustomWasmModulePhase(
|
||||
{ context, module ->
|
||||
FunctionInlining(context).inline(module)
|
||||
FunctionInlining(context, null, true).inline(module)
|
||||
module.patchDeclarationParents()
|
||||
},
|
||||
name = "FunctionInliningPhase",
|
||||
|
||||
+6
@@ -177,6 +177,12 @@ class WasmBaseTypeOperatorTransformer(val context: WasmBackendContext) : IrEleme
|
||||
}
|
||||
}
|
||||
|
||||
// A bit of a hack. Inliner tends to insert null casts from nothing to any. It's hard to express in wasm, so we simply replace
|
||||
// them with single const null.
|
||||
if (toType == builtIns.anyNType && fromType == builtIns.nothingNType && value is IrConst<*> && value.kind == IrConstKind.Null) {
|
||||
return builder.irNull(builtIns.nothingNType)
|
||||
}
|
||||
|
||||
// Handled by autoboxing transformer
|
||||
if (toType.isInlined() && !fromType.isInlined()) {
|
||||
return builder.irCall(
|
||||
|
||||
Reference in New Issue
Block a user