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

parse.y: Fix the last location of NODE_OPT_ARG

* parse.y (opt_arg_append): Update the last location of
  NODE_OPT_ARG when NODE is appended to the last.

  e.g. The locations of the first NODE_OPT_ARG is fixed:

  ```
  def a(b = 1, c = 2); end
  ```

  * Before

  ```
  NODE_OPT_ARG (line: 1, first_lineno: 1, first_column: 6, last_lineno: 1, last_column: 11)
  ```

  * After

  ```
  NODE_OPT_ARG (line: 1, first_lineno: 1, first_column: 6, last_lineno: 1, last_column: 18)
  ```

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
yui-knk 2017-11-26 23:33:23 +00:00
parent a996893397
commit 62b5c62f3d

View file

@ -9343,9 +9343,11 @@ static NODE *
opt_arg_append(NODE *opt_list, NODE *opt)
{
NODE *opts = opt_list;
opts->nd_loc.last_loc = opt->nd_loc.last_loc;
while (opts->nd_next) {
opts = opts->nd_next;
opts->nd_loc.last_loc = opt->nd_loc.last_loc;
}
opts->nd_next = opt;