Box values of inline class types when passing to function as varargs

This commit is contained in:
Mikhail Zarechenskiy
2018-02-12 05:33:12 +03:00
parent 6687751cf5
commit 3919dc94e1
11 changed files with 87 additions and 10 deletions
@@ -472,11 +472,14 @@ class ExpressionCodegen(
else {
mv.iconst(size)
newArrayInstruction(expression.type)
val elementKotlinType = outType.constructor.builtIns.getArrayElementType(outType)
for ((i, element) in expression.elements.withIndex()) {
mv.dup()
StackValue.constant(i, Type.INT_TYPE).put(Type.INT_TYPE, mv)
val rightSide = gen(element, elementType, data)
StackValue.arrayElement(elementType, StackValue.onStack(elementType), StackValue.onStack(Type.INT_TYPE)).store(rightSide, mv)
StackValue
.arrayElement(elementType, elementKotlinType, StackValue.onStack(elementType, outType), StackValue.onStack(Type.INT_TYPE))
.store(rightSide, mv)
}
}
return expression.onStack