parse.y: last location from bison

* parse.y (command): set the last location from the location
  managed by bison, so that other nodes are not needed.
  [ruby-core:89648] [Bug #15271]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-10-30 23:43:13 +00:00
parent a4cfd15a73
commit a769027f79
2 changed files with 7 additions and 2 deletions

View File

@ -1351,7 +1351,7 @@ command : fcall command_args %prec tLOWEST
{
/*%%%*/
$1->nd_args = $2;
nd_set_last_loc($1, nd_last_loc($2));
nd_set_last_loc($1, @2.end_pos);
$$ = $1;
/*% %*/
/*% ripper: command!($1, $2) %*/
@ -1363,7 +1363,7 @@ command : fcall command_args %prec tLOWEST
$1->nd_args = $2;
$$ = method_add_block(p, $1, $3, &@$);
fixpos($$, $1);
nd_set_last_loc($1, nd_last_loc($2));
nd_set_last_loc($1, @2.end_pos);
/*% %*/
/*% ripper: method_add_block!(command!($1, $2), $3) %*/
}

View File

@ -179,6 +179,11 @@ class TestSyntax < Test::Unit::TestCase
bug13756 = '[ruby-core:82113] [Bug #13756]'
assert_valid_syntax("defined? foo(**{})", bug13756)
end;
assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}")
begin;
bug15271 = '[ruby-core:89648] [Bug #15271]'
assert_valid_syntax("a **{}", bug15271)
end;
end
def test_keyword_self_reference