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

This commit is contained in:
Christopher Aue
2017-08-23 15:17:20 +02:00
parent 4aca9ef98e
commit 84d8ecc1d7
2 changed files with 28 additions and 1 deletions
+1 -1
View File
@@ -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();
}
+27
View File
@@ -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