ruby-changes:61264
From: Nobuyoshi <ko1@a...>
Date: Fri, 15 May 2020 16:35:52 +0900 (JST)
Subject: [ruby-changes:61264] 71c166e11e (master): Fixed argument forwarding in reserved word method [Bug #16854]
https://git.ruby-lang.org/ruby.git/commit/?id=71c166e11e From 71c166e11e761dcaaa943f9b94da38f86ada1bdb Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Fri, 15 May 2020 12:50:02 +0900 Subject: Fixed argument forwarding in reserved word method [Bug #16854] diff --git a/parse.y b/parse.y index 6b378b0..0ac4304 100644 --- a/parse.y +++ b/parse.y @@ -2152,10 +2152,6 @@ fname : tIDENTIFIER https://github.com/ruby/ruby/blob/trunk/parse.y#L2152 $$ = $1; } | reswords - { - SET_LEX_STATE(EXPR_ENDFN); - $$ = $1; - } ; fitem : fname @@ -8834,11 +8830,12 @@ parse_ident(struct parser_params *p, int c, int cmd_state) https://github.com/ruby/ruby/blob/trunk/parse.y#L8830 kw = rb_reserved_word(tok(p), toklen(p)); if (kw) { enum lex_state_e state = p->lex.state; - SET_LEX_STATE(kw->state); if (IS_lex_state_for(state, EXPR_FNAME)) { + SET_LEX_STATE(EXPR_ENDFN); set_yylval_name(rb_intern2(tok(p), toklen(p))); return kw->id[0]; } + SET_LEX_STATE(kw->state); if (IS_lex_state(EXPR_BEG)) { p->command_start = TRUE; } diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index 23061e3..d419fc8 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -1503,6 +1503,11 @@ eom https://github.com/ruby/ruby/blob/trunk/test/ruby/test_syntax.rb#L1503 def test_argument_forwarding assert_valid_syntax('def foo(...) bar(...) end') assert_valid_syntax('def foo(...) end') + assert_valid_syntax('def ==(...) end') + assert_valid_syntax('def [](...) end') + assert_valid_syntax('def nil(...) end') + assert_valid_syntax('def true(...) end') + assert_valid_syntax('def false(...) end') assert_syntax_error('iter do |...| end', /unexpected/) assert_syntax_error('iter {|...|}', /unexpected/) assert_syntax_error('->... {}', /unexpected/) -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/