mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
fix #1544
We have already reserved that register in codegen()'s case NODE_DEF, but what we care about is actually the previous register. So what we need is get that register by cursp() after pop(), then recover the reservation by push().
This commit is contained in:
+3
-1
@@ -646,7 +646,9 @@ scope_body(codegen_scope *s, node *tree)
|
||||
genop(scope, MKOP_AB(OP_RETURN, 0, OP_R_NORMAL));
|
||||
}
|
||||
else {
|
||||
genop_peep(scope, MKOP_AB(OP_RETURN, scope->sp, OP_R_NORMAL), NOVAL);
|
||||
pop();
|
||||
genop_peep(scope, MKOP_AB(OP_RETURN, cursp(), OP_R_NORMAL), NOVAL);
|
||||
push();
|
||||
}
|
||||
}
|
||||
scope_finish(scope);
|
||||
|
||||
Reference in New Issue
Block a user