summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2020-03-03 15:48:53 +0900
committerNobuyoshi Nakada <[email protected]>2020-03-03 16:19:49 +0900
commitc8d0bf0156878df03a71fffc97c44abf7333d5d7 (patch)
tree9bc99adc20fa0538596d84b575ebbc25097771eb
parent1ad9364440f6685d2df3b855f5e22f644e9f1f43 (diff)
Preserve `kwarg` flag and fix up f5c904c2a9
-rw-r--r--parse.y2
-rw-r--r--test/ruby/test_pattern_matching.rb2
2 files changed, 4 insertions, 0 deletions
diff --git a/parse.y b/parse.y
index 6b1686e25f..363aea33a0 100644
--- a/parse.y
+++ b/parse.y
@@ -3964,11 +3964,13 @@ p_expr_basic : p_value
| tLBRACE
{
$<tbl>$ = push_pktbl(p);
+ $<flags>1 = p->in;
p->in.kwarg = 0;
}
p_kwargs rbrace
{
pop_pktbl(p, $<tbl>2);
+ p->in.kwarg = $<flags>1.kwarg;
$$ = 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 3eea523416..3c4314bbe4 100644
--- a/test/ruby/test_pattern_matching.rb
+++ b/test/ruby/test_pattern_matching.rb
@@ -1060,6 +1060,8 @@ END
in {a:
2}
false
+ in a: {b:}, c:
+ p c
in {a:
}
_a = a