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
This commit is contained in:
yui-knk 2017-12-10 23:44:22 +00:00
Родитель f17285275c
Коммит e038b794fe
1 изменённых файлов: 8 добавлений и 2 удалений

10
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