Fixed register windows of OP_SENDs generated by NODE_OP_ASGN; ref
MODIFY
mrbgems/mruby-compiler/core/codegen.c
mrbgems/mruby-compiler/core/codegen.c
@@ -1841,7 +1841,7 @@ codegen(codegen_scope *s, node *tree, int val)
for (i=0; i<nargs; i++) {
genop(s, MKOP_AB(OP_MOVE, cursp()+i+1, base+i+1));
}
- push_n(nargs+1);pop_n(nargs+1);
+ push_n(nargs+2);pop_n(nargs+2); /* space for receiver, arguments and a block */
genop(s, MKOP_ABC(OP_SEND, cursp(), idx, callargs));
push();
}

MODIFY
test/t/codegen.rb
test/t/codegen.rb
@@ -130,6 +130,33 @@ assert('register window of calls (#3783)') do
120=>120, 121=>121, 122=>122, 123=>123, 124=>124, 125=>125, 126=>126)
end
+ # NODE_OP_ASGN
+ o = Object.new
+ class << o
+ attr_accessor :a
+ end
+
+ o.a = 1
+ assert_nothing_raised{ o.a += 1 }
+ o.a = 1
+ assert_nothing_raised{ o.a <<= 1 }
+ o.a = 1
+ assert_nothing_raised{ o.a &&= 1 }
+
+ o = { k: 1 }
+ assert_nothing_raised{ o[:k] += 1 }
+ o = { k: 1 }
+ assert_nothing_raised{ o[:k] <<= 1 }
+ o = { k: 1 }
+ assert_nothing_raised{ o[:k] &&= 1 }
+
+ o = { k: 1 }
+ assert_nothing_raised{ o[*[:k]] += 1 }
+ o = { k: 1 }
+ assert_nothing_raised{ o[*[:k]] <<= 1 }
+ o = { k: 1 }
+ assert_nothing_raised{ o[*[:k]] &&= 1 }
+
# NODE_YIELD
def check_node_yield
yield

Fixed register windows of OP_SENDs generated by NODE_OP_ASGN; ref #3783