summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-30 10:51:13 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-30 10:51:13 (GMT)
commit7132479960cff87e0d7e3fb5cb3919b791edfecc (patch)
tree4e557268aa401206c3b55aeadafa665dcdb0ebce /compile.c
parent0e42b434976e7a1c8db9d8a2fe49df7a144a4ae9 (diff)
compile.c: disallow private readers
* compile.c (iseq_compile_each): revert r46873 and r46875, not to allow to execute private readers by pretending op assign. [ruby-core:68984] [Bug #11096] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/compile.c b/compile.c
index 9427ade..e5cf964 100644
--- a/compile.c
+++ b/compile.c
@@ -4179,8 +4179,8 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
ADD_SEQ(ret, args);
}
ADD_INSN1(ret, line, dupn, FIXNUM_INC(argc, 1 + boff));
- flag |= asgnflag;
ADD_SEND_WITH_FLAG(ret, line, idAREF, argc, INT2FIX(flag));
+ flag |= asgnflag;
if (id == 0 || id == 1) {
/* 0: or, 1: and
@@ -4319,7 +4319,7 @@ 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_WITH_FLAG(ret, line, node->nd_next->nd_vid, INT2FIX(0), INT2FIX(asgnflag));
+ ADD_SEND(ret, line, node->nd_next->nd_vid, INT2FIX(0));
if (atype == 0 || atype == 1) { /* 0: OR or 1: AND */
ADD_INSN(ret, line, dup);
@@ -5479,7 +5479,6 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
DECL_ANCHOR(args);
unsigned int flag = 0;
VALUE argc;
- int asgnflag;
/* optimization shortcut
* obj["literal"] = value -> opt_aset_with(obj, "literal", value)
@@ -5509,7 +5508,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, NULL);
- flag |= (asgnflag = COMPILE_RECV(recv, "recv", node));
+ flag |= COMPILE_RECV(recv, "recv", node);
debugp_param("argc", argc);
debugp_param("nd_mid", ID2SYM(node->nd_mid));
@@ -5523,7 +5522,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_WITH_FLAG(ret, line, idAREF, INT2FIX(1), INT2FIX(asgnflag));
+ ADD_SEND(ret, line, idAREF, INT2FIX(1));
}
ADD_INSN1(ret, line, setn, FIXNUM_INC(argc, 3));
ADD_INSN (ret, line, pop);
@@ -5531,7 +5530,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_WITH_FLAG(ret, line, idAREF, INT2FIX(1), INT2FIX(asgnflag));
+ ADD_SEND(ret, line, idAREF, INT2FIX(1));
ADD_INSN1(ret, line, setn, FIXNUM_INC(argc, 2));
ADD_INSN (ret, line, pop);
}