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

ruby-changes:60543

From: Nobuyoshi <ko1@a...>
Date: Sat, 28 Mar 2020 06:14:19 +0900 (JST)
Subject: [ruby-changes:60543] 44f7e3883e (ruby_2_7): Preserve `kwarg` flag and fix up f5c904c2a9

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

From 44f7e3883e49d287a96f7ef36b5c935d833300e5 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Tue, 3 Mar 2020 15:48:53 +0900
Subject: Preserve `kwarg` flag and fix up f5c904c2a9

(cherry picked from commit c8d0bf0156878df03a71fffc97c44abf7333d5d7)

diff --git a/parse.y b/parse.y
index d249039..d34d3f9 100644
--- a/parse.y
+++ b/parse.y
@@ -3940,11 +3940,13 @@ p_expr_basic	: p_value https://github.com/ruby/ruby/blob/trunk/parse.y#L3940
 		| tLBRACE
 		    {
 			$<tbl>$ = push_pktbl(p);
+			$<num>1 = p->in_kwarg;
 			p->in_kwarg = 0;
 		    }
 		  p_kwargs rbrace
 		    {
 			pop_pktbl(p, $<tbl>2);
+			p->in_kwarg = $<num>1;
 			$$ = new_hash_pattern(p, Qnone, $3, &@$);
 		    }
 		| tLBRACE rbrace
diff --git a/test/ruby/test_pattern_matching.rb b/test/ruby/test_pattern_matching.rb
index 3eea523..3c4314b 100644
--- a/test/ruby/test_pattern_matching.rb
+++ b/test/ruby/test_pattern_matching.rb
@@ -1060,6 +1060,8 @@ END https://github.com/ruby/ruby/blob/trunk/test/ruby/test_pattern_matching.rb#L1060
       in {a:
             2}
         false
+      in a: {b:}, c:
+        p c
       in {a:
       }
         _a = a
-- 
cgit v0.10.2


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

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