summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authornagachika <nagachika@ruby-lang.org>2022-09-10 16:00:29 +0900
committernagachika <nagachika@ruby-lang.org>2022-09-10 16:00:29 +0900
commit163947f4dc031bb5e619ae64ad4a6a02f8885717 (patch)
tree688d742ba7e8c5d36c761c4ccf3c84741c9808b5 /parse.y
parentc498b16aaa485312e26b0b2109a5950da4cbb7c5 (diff)
merge revision(s) db0e0dad1171456253ebd899e7e878823923d3d8: [Backport #18990]
Fix unexpected "duplicated key name" error in paren-less one line pattern matching [Bug #18990] --- parse.y | 16 ++++++++++++---- test/ruby/test_pattern_matching.rb | 12 ++++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-)
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y16
1 files changed, 12 insertions, 4 deletions
diff --git a/parse.y b/parse.y
index 4e05bfd672..e3e680414a 100644
--- a/parse.y
+++ b/parse.y
@@ -1762,14 +1762,18 @@ expr : command_call
p->ctxt.in_kwarg = 1;
$<tbl>$ = push_pvtbl(p);
}
+ {
+ $<tbl>$ = push_pktbl(p);
+ }
p_top_expr_body
{
+ pop_pktbl(p, $<tbl>4);
pop_pvtbl(p, $<tbl>3);
p->ctxt.in_kwarg = $<ctxt>2.in_kwarg;
/*%%%*/
- $$ = NEW_CASE3($1, NEW_IN($4, 0, 0, &@4), &@$);
+ $$ = NEW_CASE3($1, NEW_IN($5, 0, 0, &@5), &@$);
/*% %*/
- /*% ripper: case!($1, in!($4, Qnil, Qnil)) %*/
+ /*% ripper: case!($1, in!($5, Qnil, Qnil)) %*/
}
| arg keyword_in
{
@@ -1780,14 +1784,18 @@ expr : command_call
p->ctxt.in_kwarg = 1;
$<tbl>$ = push_pvtbl(p);
}
+ {
+ $<tbl>$ = push_pktbl(p);
+ }
p_top_expr_body
{
+ pop_pktbl(p, $<tbl>4);
pop_pvtbl(p, $<tbl>3);
p->ctxt.in_kwarg = $<ctxt>2.in_kwarg;
/*%%%*/
- $$ = NEW_CASE3($1, NEW_IN($4, NEW_TRUE(&@4), NEW_FALSE(&@4), &@4), &@$);
+ $$ = NEW_CASE3($1, NEW_IN($5, NEW_TRUE(&@5), NEW_FALSE(&@5), &@5), &@$);
/*% %*/
- /*% ripper: case!($1, in!($4, Qnil, Qnil)) %*/
+ /*% ripper: case!($1, in!($5, Qnil, Qnil)) %*/
}
| arg %prec tLBRACE_ARG
;