Commit 8d6f1b04 authored by Takashi Sogabe's avatar Takashi Sogabe

Fix disappearance of a local variable when return statement is called

Commit of #18dd60c1 causes disappearance of a local variable
if return statement is called without arguments.

This patch fixes incorrect value of stack pointer.

test program:
def test_return_cond
  return if nil
  obj = 123
  p obj
  p obj.class
end
test_return_cond

output(commit #18dd60c1):
main
Object

output(includes this patch):
123
Fixnum
parent 265fa03d
......@@ -1490,6 +1490,7 @@ codegen(codegen_scope *s, node *tree, int val)
else {
genop_peep(s, MKOP_AB(OP_RETURN, cursp(), OP_R_NORMAL), NOVAL);
}
push();
break;
case NODE_YIELD:
......
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