Fix location of assignable nodes

* parse.y (node_assign_gen): NODE_ATTRASGN is created
  before rhs is created. It is needed to set location
  after rhs is created to rhs range be included to the
  location of NODE_ATTRASGN.

  e.g. The locations of NODE_ATTRASGN is fixed:

  ```
  a[1] = 2
  ```

  * Before

  ```
  NODE_ATTRASGN (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 4)
  ```

  * After

  ```
  NODE_ATTRASGN (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 8)
  ```

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60821 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
yui-knk 2017-11-17 07:39:15 +00:00
parent d2bb08ecf0
commit 114fc2201c

View File

@ -10125,6 +10125,7 @@ node_assign_gen(struct parser_params *parser, NODE *lhs, NODE *rhs, const YYLTYP
case NODE_ATTRASGN:
case NODE_CALL:
lhs->nd_args = arg_append(lhs->nd_args, rhs, location);
lhs->nd_loc = *location;
break;
default: