summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-10 23:44:22 +0000
committeryui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-10 23:44:22 +0000
commite038b794fe673583b413d81a8933bdc0aead85fe (patch)
tree39c9f333596a569466cf7cbcd45d4944c671d78a
parentf17285275c96e2143ee69bedfa58aeb2a5ba7d6f (diff)
parse.y: Fix the last location of NODE_COLON2
* parse.y: Fix to only include a range from primary_value to tCONSTANT. e.g. The locations of the NODE_COLON2 is fixed: ``` A::B ||= 1 ``` * Before ``` NODE_COLON2 (line: 1, code_range: (1,0)-(1,10)) ``` * After ``` NODE_COLON2 (line: 1, code_range: (1,0)-(1,4)) ``` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61101 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--parse.y10
1 files changed, 8 insertions, 2 deletions
diff --git a/parse.y b/parse.y
index 31e303c059..8b486150b4 100644
--- a/parse.y
+++ b/parse.y
@@ -1550,7 +1550,10 @@ command_asgn : lhs '=' command_rhs
}
| primary_value tCOLON2 tCONSTANT tOP_ASGN command_rhs
{
- $$ = const_path_field($1, $3, &@$);
+ YYLTYPE location;
+ location.first_loc = @1.first_loc;
+ location.last_loc = @3.last_loc;
+ $$ = const_path_field($1, $3, &location);
$$ = new_const_op_assign($$, $4, $5, &@$);
}
| primary_value tCOLON2 tIDENTIFIER tOP_ASGN command_rhs
@@ -2214,7 +2217,10 @@ arg : lhs '=' arg_rhs
}
| primary_value tCOLON2 tCONSTANT tOP_ASGN arg_rhs
{
- $$ = const_path_field($1, $3, &@$);
+ YYLTYPE location;
+ location.first_loc = @1.first_loc;
+ location.last_loc = @3.last_loc;
+ $$ = const_path_field($1, $3, &location);
$$ = new_const_op_assign($$, $4, $5, &@$);
}
| tCOLON3 tCONSTANT tOP_ASGN arg_rhs