summaryrefslogtreecommitdiffstats
path: root/parse.y
diff options
context:
space:
mode:
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y37
1 files changed, 35 insertions, 2 deletions
diff --git a/parse.y b/parse.y
index bda57f428..f98d0c370 100644
--- a/parse.y
+++ b/parse.y
@@ -1792,9 +1792,11 @@ arg : lhs '=' arg
| lhs '=' arg modifier_rescue arg
{
/*%%%*/
- $$ = node_assign($1, NEW_RESCUE($3, NEW_RESBODY(0,$5,0), 0));
+ value_expr($3);
+ $3 = NEW_RESCUE($3, NEW_RESBODY(0,$5,0), 0);
+ $$ = node_assign($1, $3);
/*%
- $$ = dispatch2(assign, $1, dispatch2(rescue_mod,$3,$5));
+ $$ = dispatch2(assign, $1, dispatch2(rescue_mod, $3, $5));
%*/
}
| var_lhs tOP_ASGN arg
@@ -1826,6 +1828,37 @@ arg : lhs '=' arg
$$ = dispatch3(opassign, $1, $2, $3);
%*/
}
+ | var_lhs tOP_ASGN arg modifier_rescue arg
+ {
+ /*%%%*/
+ value_expr($3);
+ $3 = NEW_RESCUE($3, NEW_RESBODY(0,$5,0), 0);
+ if ($1) {
+ ID vid = $1->nd_vid;
+ if ($2 == tOROP) {
+ $1->nd_value = $3;
+ $$ = NEW_OP_ASGN_OR(gettable(vid), $1);
+ if (is_asgn_or_id(vid)) {
+ $$->nd_aid = vid;
+ }
+ }
+ else if ($2 == tANDOP) {
+ $1->nd_value = $3;
+ $$ = NEW_OP_ASGN_AND(gettable(vid), $1);
+ }
+ else {
+ $$ = $1;
+ $$->nd_value = NEW_CALL(gettable(vid), $2, NEW_LIST($3));
+ }
+ }
+ else {
+ $$ = NEW_BEGIN(0);
+ }
+ /*%
+ $3 = dispatch2(rescue_mod, $3, $5);
+ $$ = dispatch3(opassign, $1, $2, $3);
+ %*/
+ }
| primary_value '[' opt_call_args rbracket tOP_ASGN arg
{
/*%%%*/