mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Fixed register windows of OP_SENDs generated by NODE_{FOR,SYMBOLS}; ref #3783
This commit is contained in:
@@ -631,6 +631,7 @@ for_body(codegen_scope *s, node *tree)
|
||||
scope_finish(s);
|
||||
s = prev;
|
||||
genop(s, MKOP_Abc(OP_LAMBDA, cursp(), s->irep->rlen-1, OP_L_BLOCK));
|
||||
push();pop(); /* space for a block */
|
||||
pop();
|
||||
idx = new_msym(s, mrb_intern_lit(s->mrb, "each"));
|
||||
genop(s, MKOP_ABC(OP_SENDB, cursp(), idx, 0));
|
||||
@@ -1095,6 +1096,7 @@ gen_vmassignment(codegen_scope *s, node *tree, int rhs, int val)
|
||||
static void
|
||||
gen_send_intern(codegen_scope *s)
|
||||
{
|
||||
push();pop(); /* space for a block */
|
||||
pop();
|
||||
genop(s, MKOP_ABC(OP_SEND, cursp(), new_msym(s, mrb_intern_lit(s->mrb, "intern")), 0));
|
||||
push();
|
||||
|
||||
@@ -75,6 +75,16 @@ assert('negate literal register alignment') do
|
||||
end
|
||||
|
||||
assert('register window of calls (#3783)') do
|
||||
# NODE_FOR
|
||||
assert_nothing_raised do
|
||||
for i in []; end
|
||||
end
|
||||
|
||||
# NODE_SYMBOLS
|
||||
assert_nothing_raised do
|
||||
%i(sym)
|
||||
end
|
||||
|
||||
# NODE_SCALL
|
||||
assert_nothing_raised do
|
||||
Object.new&.__id__
|
||||
|
||||
Reference in New Issue
Block a user