From c888b8d63b714d5ccf107272b10d723c75fbe7dd Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Wed, 24 Jan 2024 13:43:04 -0500 Subject: [PATCH] [PRISM] Handle implicit lvar write in hash pattern --- prism_compile.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/prism_compile.c b/prism_compile.c index c526a1b3b7..20eb457bfb 100644 --- a/prism_compile.c +++ b/prism_compile.c @@ -1944,7 +1944,12 @@ pm_compile_pattern(rb_iseq_t *iseq, pm_scope_node_t *scope_node, const pm_node_t ADD_INSN1(match_values, &line.node, putobject, symbol); ADD_SEND(match_values, &line.node, has_rest ? rb_intern("delete") : idAREF, INT2FIX(1)); - CHECK(pm_compile_pattern_match(iseq, scope_node, assoc->value, match_values, src, match_failed_label, in_single_pattern, in_alternation_pattern, false, base_index + 1)); + const pm_node_t *value = assoc->value; + if (PM_NODE_TYPE_P(value, PM_IMPLICIT_NODE)) { + value = ((const pm_implicit_node_t *) value)->value; + } + + CHECK(pm_compile_pattern_match(iseq, scope_node, value, match_values, src, match_failed_label, in_single_pattern, in_alternation_pattern, false, base_index + 1)); } ADD_SEQ(ret, match_values);