From a40e2b8ee9632b07064af4c99efdafda814df391 Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Mon, 23 Oct 2023 10:42:55 -0400 Subject: [ruby/prism] Fix parsing lone assoc splat within hash patterns https://github.com/ruby/prism/commit/1da5e05672 --- lib/prism/pattern.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/prism/pattern.rb b/lib/prism/pattern.rb index 0f606bc31f..01f5b0ef5a 100644 --- a/lib/prism/pattern.rb +++ b/lib/prism/pattern.rb @@ -158,12 +158,12 @@ module Prism # in InstanceVariableReadNode[name: Symbol] # in { name: Symbol } def compile_hash_pattern_node(node) - compile_error(node) unless node.kwrest.nil? + compile_error(node) if node.rest compiled_constant = compile_node(node.constant) if node.constant preprocessed = - node.assocs.to_h do |assoc| - [assoc.key.unescaped.to_sym, compile_node(assoc.value)] + node.elements.to_h do |element| + [element.key.unescaped.to_sym, compile_node(element.value)] end compiled_keywords = ->(other) do -- cgit v1.2.3