Commit c647dff1 authored by fleuria's avatar fleuria

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().
parent a230a88e
......@@ -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);
......
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