summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-06 08:07:13 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-06 08:07:13 +0000
commit199f814f32e97b2fed528801c0ad2c84c1e5f8a6 (patch)
tree891c580dfbc7836a0aa774dbc84e838296c83175 /parse.y
parent7342e78ea6650a6a58f8ad448df01d448383496d (diff)
compile.c, parse.y: private op assign
* compile.c (iseq_compile_each), parse.y (new_attr_op_assign_gen): allow op assign to a private attribute. [ruby-core:62949] [Bug #9907] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y5
1 files changed, 3 insertions, 2 deletions
diff --git a/parse.y b/parse.y
index d2076a8d6d..a9f7d5db82 100644
--- a/parse.y
+++ b/parse.y
@@ -1206,7 +1206,7 @@ stmt : keyword_alias fitem {lex_state = EXPR_FNAME;} fitem
else if ($5 == tANDOP) {
$5 = 1;
}
- $$ = NEW_OP_ASGN1($1, $5, args);
+ $$ = NEW_OP_ASGN1(attr_receiver($1), $5, args);
fixpos($$, $1);
/*%
$$ = dispatch2(aref_field, $1, escape_Qundef($3));
@@ -1998,7 +1998,7 @@ arg : lhs '=' arg
else if ($5 == tANDOP) {
$5 = 1;
}
- $$ = NEW_OP_ASGN1($1, $5, args);
+ $$ = NEW_OP_ASGN1(attr_receiver($1), $5, args);
fixpos($$, $1);
/*%
$1 = dispatch2(aref_field, $1, escape_Qundef($3));
@@ -9650,6 +9650,7 @@ new_attr_op_assign_gen(struct parser_params *parser, NODE *lhs, ID attr, ID op,
else if (op == tANDOP) {
op = 1;
}
+ lhs = attr_receiver(lhs);
asgn = NEW_OP_ASGN2(lhs, attr, op, rhs);
fixpos(asgn, lhs);
return asgn;