ruby-changes:59712
From: Nobuyoshi <ko1@a...>
Date: Thu, 16 Jan 2020 18:35:11 +0900 (JST)
Subject: [ruby-changes:59712] f38b3e8c70 (master): Fixed the location of args node with numbered parameter
https://git.ruby-lang.org/ruby.git/commit/?id=f38b3e8c70 From f38b3e8c707ebdcad05aa9485cf1760640b74fbb Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Thu, 16 Jan 2020 18:34:31 +0900 Subject: Fixed the location of args node with numbered parameter diff --git a/parse.y b/parse.y index d1d2569..21b384d 100644 --- a/parse.y +++ b/parse.y @@ -11377,7 +11377,11 @@ static NODE * https://github.com/ruby/ruby/blob/trunk/parse.y#L11377 args_with_numbered(struct parser_params *p, NODE *args, int max_numparam) { if (max_numparam > NO_PARAM) { - if (!args) args = new_args_tail(p, 0, 0, 0, 0); + if (!args) { + YYLTYPE loc = RUBY_INIT_YYLLOC(); + args = new_args_tail(p, 0, 0, 0, 0); + nd_set_loc(args, &loc); + } args->nd_ainfo->pre_args_num = max_numparam; } return args; diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index 01f3295..b93062c 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -1449,6 +1449,8 @@ eom https://github.com/ruby/ruby/blob/trunk/test/ruby/test_syntax.rb#L1449 assert_valid_syntax("->{#{c};->{_1};end;_1}\n") assert_valid_syntax("->{_1;#{c};->{_1};end}\n") end + + 1.times {_1} end def test_value_expr_in_condition -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/