Skip to content

Commit

Permalink
parse.y: Fix the locations of NODE_FCALL
Browse files Browse the repository at this point in the history
  * parse.y: Update the locations of NODE_FCALL
    when nd_args is determined.

  e.g. The locations of NODE_FCALL is fixed:

  ```
  a 1
  ```

  * Before

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

  * After

  ```
  NODE_FCALL (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 3)
  ```

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
yui-knk committed Nov 20, 2017
1 parent b7cbe4e commit 4b279cf
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions parse.y
Expand Up @@ -1645,6 +1645,8 @@ command : fcall command_args %prec tLOWEST
/*%%%*/
$$ = $1;
$$->nd_args = $2;
nd_set_last_lineno($1, nd_last_lineno($2));
nd_set_last_column($1, nd_last_column($2));
/*%
$$ = dispatch2(command, $1, $2);
%*/
Expand All @@ -1655,6 +1657,11 @@ command : fcall command_args %prec tLOWEST
$$ = new_command($1, $2);
$$ = method_add_block($$, $3);
fixpos($$, $1);
/*%%%*/
nd_set_last_lineno($1, nd_last_lineno($2));
nd_set_last_column($1, nd_last_column($2));
/*%
%*/
}
| primary_value call_op operation2 command_args %prec tLOWEST
{
Expand Down Expand Up @@ -3670,6 +3677,8 @@ method_call : fcall paren_args
/*%%%*/
$$ = $1;
$$->nd_args = $2;
nd_set_last_lineno($1, @2.last_loc.lineno);
nd_set_last_column($1, @2.last_loc.column);
/*%
$$ = method_arg(dispatch1(fcall, $1), $2);
%*/
Expand Down

0 comments on commit 4b279cf

Please sign in to comment.