summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authoryui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-08 00:33:38 +0000
committeryui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-08 00:33:38 +0000
commitc6b31b76eed937ff3a8f796d3106338bb3583da9 (patch)
treea12ae7050a090a951e30bd4c9ae6e6aba36f9c5f /parse.y
parent3bc080bac9d0711c617202723224c95e9043047b (diff)
parse.y: Fix locations of modifier_rescue
* parse.y: Fix to only include a range from modifier_rescue to stmt (or arg). e.g. The locations of the NODE_RESBODY is fixed: ``` a rescue 1 ``` * Before ``` NODE_RESBODY (line: 1, code_range: (1,0)-(1,10)) ``` * After ``` NODE_RESBODY (line: 1, code_range: (1,2)-(1,10)) ``` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y15
1 files changed, 12 insertions, 3 deletions
diff --git a/parse.y b/parse.y
index e18c50c194..1fc2a73aac 100644
--- a/parse.y
+++ b/parse.y
@@ -1453,7 +1453,10 @@ stmt : keyword_alias fitem {SET_LEX_STATE(EXPR_FNAME|EXPR_FITEM);} fitem
| stmt modifier_rescue stmt
{
/*%%%*/
- NODE *resq = new_resbody(0, remove_begin($3), 0, &@$);
+ YYLTYPE location;
+ location.first_loc = @2.first_loc;
+ location.last_loc = @3.last_loc;
+ NODE *resq = new_resbody(0, remove_begin($3), 0, &location);
$$ = new_rescue(remove_begin($1), resq, 0, &@$);
/*%
$$ = dispatch2(rescue_mod, $1, $3);
@@ -1572,8 +1575,11 @@ command_rhs : command_call %prec tOP_ASGN
| command_call modifier_rescue stmt
{
/*%%%*/
+ YYLTYPE location;
+ location.first_loc = @2.first_loc;
+ location.last_loc = @3.last_loc;
value_expr($1);
- $$ = new_rescue($1, new_resbody(0, remove_begin($3), 0, &@$), 0, &@$);
+ $$ = new_rescue($1, new_resbody(0, remove_begin($3), 0, &location), 0, &@$);
/*%
$$ = dispatch2(rescue_mod, $1, $3);
%*/
@@ -2423,8 +2429,11 @@ arg_rhs : arg %prec tOP_ASGN
| arg modifier_rescue arg
{
/*%%%*/
+ YYLTYPE location;
+ location.first_loc = @2.first_loc;
+ location.last_loc = @3.last_loc;
value_expr($1);
- $$ = new_rescue($1, new_resbody(0, remove_begin($3), 0, &@$), 0, &@$);
+ $$ = new_rescue($1, new_resbody(0, remove_begin($3), 0, &location), 0, &@$);
/*%
$$ = dispatch2(rescue_mod, $1, $3);
%*/