WASM: Properly handle nullable exported strings
This commit is contained in:
committed by
TeamCityServer
parent
468fe4196d
commit
80140207b5
+1
-1
@@ -369,7 +369,7 @@ class BodyGenerator(val context: WasmFunctionCodegenContext) : IrElementVisitorV
|
||||
// Handle complex exported parameters.
|
||||
// TODO: This should live as a separate lowering which creates separate shims for each exported function.
|
||||
if (context.irFunction.isExported(context.backendContext) &&
|
||||
expression.value.type == irBuiltIns.stringType) {
|
||||
expression.value.type.getClass() == irBuiltIns.stringType.getClass()) {
|
||||
|
||||
body.buildCall(context.referenceFunction(wasmSymbols.exportString))
|
||||
}
|
||||
|
||||
+2
-1
@@ -16,6 +16,7 @@ import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.types.defaultType
|
||||
import org.jetbrains.kotlin.ir.types.getClass
|
||||
import org.jetbrains.kotlin.ir.types.isNothing
|
||||
import org.jetbrains.kotlin.ir.util.isFunction
|
||||
import org.jetbrains.kotlin.ir.util.parentAsClass
|
||||
@@ -59,7 +60,7 @@ class WasmModuleCodegenContextImpl(
|
||||
|
||||
override fun transformExportedResultType(irType: IrType): WasmType? {
|
||||
// Exported strings are passed as pointers to the raw memory
|
||||
if (irType == backendContext.irBuiltIns.stringType)
|
||||
if (irType.getClass() == backendContext.irBuiltIns.stringType.getClass())
|
||||
return WasmI32
|
||||
return with(typeTransformer) { irType.toWasmResultType() }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user