Scripts: coerce result to the actual expression type

#KT-5622 Fixed
This commit is contained in:
Alexander Udalov
2014-08-13 16:14:28 +04:00
parent 6e46bea821
commit 9c00e1c94d
4 changed files with 35 additions and 2 deletions
@@ -193,7 +193,7 @@ public class ScriptCodegen extends MemberCodegen<JetScript> {
StackValue stackValue =
new ExpressionCodegen(mv, frameMap, Type.VOID_TYPE, methodContext, state, this).gen(scriptDeclaration.getBlockExpression());
if (stackValue.type != Type.VOID_TYPE) {
stackValue.put(stackValue.type, iv);
stackValue.put(blockType, iv);
iv.putfield(classType.getInternalName(), ScriptDescriptor.LAST_EXPRESSION_VALUE_FIELD_NAME, blockType.getDescriptor());
}