1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

parse.y: Set the last location of NODE_ARRAY in %i

* parse.y: list_append uses the locations
    of the second argument. So we should set the
    locations of $2 before pass it to list_append.

  e.g. The locations of NODE_ARRAY is fixed:

  ```
  %i[a b]
  ```

  * Before

  ```
  NODE_ARRAY (line: 1, first_lineno: 1, first_column: 0, last_lineno: 0, last_column: -1)
  ```

  * After

  ```
  NODE_ARRAY (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 7)
  ```

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
yui-knk 2017-11-20 22:48:05 +00:00
parent 0e7c83e374
commit 45100dbeb2

View file

@ -4124,8 +4124,8 @@ qsym_list : /* none */
lit = $2->nd_lit;
nd_set_type($2, NODE_LIT);
add_mark_object($2->nd_lit = ID2SYM(rb_intern_str(lit)));
$$ = list_append($1, $2, &@$);
$2->nd_loc = @$;
$$ = list_append($1, $2, &@$);
/*%
$$ = dispatch2(qsymbols_add, $1, $2);
%*/