Support IrExpressionBody in codegen

This commit is contained in:
Mikhael Bogdanov
2017-06-01 12:54:03 +02:00
parent 4017195ff1
commit 039e036e22
@@ -124,6 +124,9 @@ class ExpressionCodegen(
//for implicit return
mv.areturn(Type.VOID_TYPE)
}
else if (irFunction.body is IrExpressionBody) {
mv.areturn(returnType)
}
writeLocalVariablesInTable(info)
mv.visitEnd()
}
@@ -367,6 +370,10 @@ class ExpressionCodegen(
return expression.onStack
}
override fun visitExpressionBody(body: IrExpressionBody, data: BlockInfo): StackValue {
return body.expression.accept(this, data)
}
override fun visitElement(element: IrElement, data: BlockInfo): StackValue {
TODO("not implemented for $element") //To change body of created functions use File | Settings | File Templates.
}