[WASM] Add missing implicit casts
This commit is contained in:
+14
-3
@@ -234,6 +234,12 @@ class WasmBaseTypeOperatorTransformer(val context: WasmBackendContext) : IrEleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (toType == symbols.voidType) {
|
||||||
|
return builder.irCall(symbols.consumeAnyIntoVoid).apply {
|
||||||
|
putValueArgument(0, value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return builder.irCall(symbols.refCast, type = toType).apply {
|
return builder.irCall(symbols.refCast, type = toType).apply {
|
||||||
putTypeArgument(0, toType)
|
putTypeArgument(0, toType)
|
||||||
putValueArgument(0, value)
|
putValueArgument(0, value)
|
||||||
@@ -324,9 +330,14 @@ class WasmBaseTypeOperatorTransformer(val context: WasmBackendContext) : IrEleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun generateIsExternalClass(argument: IrExpression, klass: IrClass): IrExpression {
|
private fun generateIsExternalClass(argument: IrExpression, klass: IrClass): IrExpression {
|
||||||
val function = context.mapping.wasmJsInteropFunctionToWrapper[context.mapping.wasmExternalClassToInstanceCheck[klass]!!]!!
|
val instanceCheckFunction = context.mapping.wasmExternalClassToInstanceCheck[klass]!!
|
||||||
return builder.irCall(function).also {
|
val wrappedInstanceCheckIfAny = context.mapping.wasmJsInteropFunctionToWrapper[instanceCheckFunction] ?: instanceCheckFunction
|
||||||
it.putValueArgument(0, argument)
|
|
||||||
|
return builder.irCall(wrappedInstanceCheckIfAny).also {
|
||||||
|
it.putValueArgument(
|
||||||
|
index = 0,
|
||||||
|
valueArgument = narrowType(argument.type, context.irBuiltIns.anyType, argument) //TODO("Why we need it?)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user