From 8d6f1b04a1f326e3668fd1b2aa0978c2bb38b3ff Mon Sep 17 00:00:00 2001 From: Takashi Sogabe Date: Wed, 17 Oct 2012 12:55:50 +0900 Subject: Fix disappearance of a local variable when return statement is called Commit of #18dd60c 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 #18dd60c): main Object output(includes this patch): 123 Fixnum --- src/codegen.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/codegen.c b/src/codegen.c index f195c378a..27f217ebe 100644 --- a/src/codegen.c +++ b/src/codegen.c @@ -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: -- cgit v1.2.3