[前][次][番号順一覧][スレッド一覧]

ruby-changes:62393

From: nagachika <ko1@a...>
Date: Sat, 25 Jul 2020 13:41:03 +0900 (JST)
Subject: [ruby-changes:62393] be359442cb (ruby_2_7): merge revision(s) 71c166e11e761dcaaa943f9b94da38f86ada1bdb: [Backport #16854]

https://git.ruby-lang.org/ruby.git/commit/?id=be359442cb

From be359442cb07c25fdc769431ffed3249b9016829 Mon Sep 17 00:00:00 2001
From: nagachika <nagachika@r...>
Date: Sat, 25 Jul 2020 13:40:48 +0900
Subject: merge revision(s) 71c166e11e761dcaaa943f9b94da38f86ada1bdb: [Backport
 #16854]

	Fixed argument forwarding in reserved word method [Bug #16854]

diff --git a/parse.y b/parse.y
index e57cc11..54515f9 100644
--- a/parse.y
+++ b/parse.y
@@ -2023,10 +2023,6 @@ fname		: tIDENTIFIER https://github.com/ruby/ruby/blob/trunk/parse.y#L2023
 			$$ = $1;
 		    }
 		| reswords
-		    {
-			SET_LEX_STATE(EXPR_ENDFN);
-			$$ = $1;
-		    }
 		;
 
 fitem		: fname
@@ -8738,11 +8734,12 @@ parse_ident(struct parser_params *p, int c, int cmd_state) https://github.com/ruby/ruby/blob/trunk/parse.y#L8734
 	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 21b0bc7..93d9446 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -1466,6 +1466,11 @@ eom https://github.com/ruby/ruby/blob/trunk/test/ruby/test_syntax.rb#L1466
   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/)
diff --git a/version.h b/version.h
index c0953fe..8a4b3ed 100644
--- a/version.h
+++ b/version.h
@@ -2,7 +2,7 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L2
 # define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
 #define RUBY_VERSION_TEENY 1
 #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 109
+#define RUBY_PATCHLEVEL 110
 
 #define RUBY_RELEASE_YEAR 2020
 #define RUBY_RELEASE_MONTH 7
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]