[JS IR BE] Fix type for lowered cast expression
Safe cast result type is different from its type operand.
This commit is contained in:
+2
-2
@@ -109,10 +109,10 @@ class TypeOperatorLowering(val context: JsIrBackendContext) : FileLoweringPass {
|
|||||||
val argument = cacheValue(expression.argument, newStatements, declaration)
|
val argument = cacheValue(expression.argument, newStatements, declaration)
|
||||||
val check = generateTypeCheck(argument, toType)
|
val check = generateTypeCheck(argument, toType)
|
||||||
|
|
||||||
newStatements += JsIrBuilder.buildIfElse(toType, check, argument(), failResult)
|
newStatements += JsIrBuilder.buildIfElse(expression.type, check, argument(), failResult)
|
||||||
|
|
||||||
return expression.run {
|
return expression.run {
|
||||||
IrCompositeImpl(startOffset, endOffset, toType, null, newStatements)
|
IrCompositeImpl(startOffset, endOffset, expression.type, null, newStatements)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user