[Wasm] Fix invalid boxing for non-primitive typed vararg

This commit is contained in:
Igor Yakovlev
2022-12-07 19:51:43 +01:00
committed by teamcity
parent dc2dcfffee
commit 3be3ae4895
12 changed files with 104 additions and 2 deletions
@@ -114,7 +114,7 @@ abstract class AbstractValueUsageLowering(val context: JsCommonBackendContext) :
if (icUtils.isTypeInlined(element.type) && !icUtils.isTypeInlined(expression.type) && !expression.type.isPrimitiveArray())
irBuiltIns.anyNType
else
expression.varargElementType
if (!expression.type.isPrimitiveArray()) irBuiltIns.anyNType else expression.varargElementType
)
}
@@ -136,6 +136,14 @@ class AutoboxingTransformer(context: JsCommonBackendContext) : AbstractValueUsag
return res
}
override fun visitFunction(declaration: IrFunction): IrStatement {
return super.visitFunction(declaration)
}
override fun visitVararg(expression: IrVararg): IrExpression {
return super.visitVararg(expression)
}
override fun IrExpression.useAsResult(enclosing: IrExpression): IrExpression {
if (processingReturnStack.lastOrNull()?.value == enclosing && enclosing is IrReturnableBlock) {
return useReturnableExpressionAsType(enclosing.type)