adjust register position for return value; fix #1620

parent efbaa53c
...@@ -674,9 +674,7 @@ scope_body(codegen_scope *s, node *tree, int val) ...@@ -674,9 +674,7 @@ scope_body(codegen_scope *s, node *tree, int val)
genop(scope, MKOP_AB(OP_RETURN, 0, OP_R_NORMAL)); genop(scope, MKOP_AB(OP_RETURN, 0, OP_R_NORMAL));
} }
else { else {
pop(); genop_peep(scope, MKOP_AB(OP_RETURN, scope->sp-1, OP_R_NORMAL), NOVAL);
genop_peep(scope, MKOP_AB(OP_RETURN, cursp(), OP_R_NORMAL), NOVAL);
push();
} }
} }
scope_finish(scope); scope_finish(scope);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment