parse.y: Fix locations of dsym

* parse.y: Fix to only include a range from tSTRING_BEG to tLABEL_END.

  e.g. The locations of the NODE_LIT is fixed:

  ```
  { "a": 10 }
  ```

  * Before

  ```
  NODE_LIT (line: 1, code_range: (1,2)-(1,9))
  ```

  * After

  ```
  NODE_LIT (line: 1, code_range: (1,2)-(1,6))
  ```

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
yui-knk 2017-12-07 03:00:36 +00:00
parent acf7e52d88
commit 803d1753b7

View File

@ -4998,7 +4998,8 @@ assoc : arg_value tASSOC arg_value
| tSTRING_BEG string_contents tLABEL_END arg_value
{
/*%%%*/
$$ = list_append(new_list(dsym_node($2, &@$), &@$), $4, &@$);
YYLTYPE location = {@1.first_loc, @3.last_loc};
$$ = list_append(new_list(dsym_node($2, &location), &location), $4, &@$);
/*%
$$ = dispatch2(assoc_new, dispatch1(dyna_symbol, $2), $4);
%*/