summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-19 03:40:52 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-19 03:40:52 +0000
commitbc45eed1e5133f917cfeee092a697b230493c16c (patch)
treef58291c60aff8d83ddc5e9b4e950ceb041e1d72a /compile.c
parentf75b676cc4f5411c4c1aa8cc9cb48d5dd665af6f (diff)
compile.c: private reader in op_assign
* compile.c (iseq_compile_each): allow to access private attribute reader in op_assign. [ruby-core:63817] [Bug #10060] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/compile.c b/compile.c
index 637e112..3e4f3f6 100644
--- a/compile.c
+++ b/compile.c
@@ -4178,8 +4178,8 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
asgnflag = COMPILE_RECV(ret, "NODE_OP_ASGN2#recv", node);
ADD_INSN(ret, line, dup);
- ADD_SEND(ret, line, ID2SYM(node->nd_next->nd_vid),
- INT2FIX(0));
+ ADD_SEND_R(ret, line, ID2SYM(node->nd_next->nd_vid),
+ INT2FIX(0), Qfalse, INT2FIX(asgnflag));
if (atype == 0 || atype == 1) { /* 0: OR or 1: AND */
ADD_INSN(ret, line, dup);
@@ -5331,6 +5331,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
DECL_ANCHOR(args);
VALUE flag = 0;
VALUE argc;
+ int asgnflag;
/* optimization shortcut
* obj["literal"] = value -> opt_aset_with(obj, "literal", value)
@@ -5358,7 +5359,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
INIT_ANCHOR(args);
argc = setup_args(iseq, args, node->nd_args, &flag);
- flag |= COMPILE_RECV(recv, "recv", node);
+ flag |= (asgnflag = COMPILE_RECV(recv, "recv", node));
debugp_param("argc", argc);
debugp_param("nd_mid", ID2SYM(node->nd_mid));
@@ -5372,7 +5373,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
ADD_INSN1(ret, line, topn, INT2FIX(1));
if (flag & VM_CALL_ARGS_SPLAT) {
ADD_INSN1(ret, line, putobject, INT2FIX(-1));
- ADD_SEND(ret, line, ID2SYM(idAREF), INT2FIX(1));
+ ADD_SEND_R(ret, line, ID2SYM(idAREF), INT2FIX(1), Qfalse, INT2FIX(asgnflag));
}
ADD_INSN1(ret, line, setn, FIXNUM_INC(argc, 3));
ADD_INSN (ret, line, pop);
@@ -5380,7 +5381,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
else if (flag & VM_CALL_ARGS_SPLAT) {
ADD_INSN(ret, line, dup);
ADD_INSN1(ret, line, putobject, INT2FIX(-1));
- ADD_SEND(ret, line, ID2SYM(idAREF), INT2FIX(1));
+ ADD_SEND_R(ret, line, ID2SYM(idAREF), INT2FIX(1), Qfalse, INT2FIX(asgnflag));
ADD_INSN1(ret, line, setn, FIXNUM_INC(argc, 2));
ADD_INSN (ret, line, pop);
}