From e038b794fe673583b413d81a8933bdc0aead85fe Mon Sep 17 00:00:00 2001 From: yui-knk Date: Sun, 10 Dec 2017 23:44:22 +0000 Subject: 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 --- parse.y | 10 ++++++++-- 1 file 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 -- cgit v1.2.3