diff options
author | yui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-10 23:44:22 +0000 |
---|---|---|
committer | yui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-10 23:44:22 +0000 |
commit | e038b794fe673583b413d81a8933bdc0aead85fe (patch) | |
tree | 39c9f333596a569466cf7cbcd45d4944c671d78a /parse.y | |
parent | f17285275c96e2143ee69bedfa58aeb2a5ba7d6f (diff) | |
download | ruby-e038b794fe673583b413d81a8933bdc0aead85fe.tar.gz |
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
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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 |