From 49383901772f874569bbdc992867bd02b4b597a8 Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Tue, 28 Nov 2023 15:49:04 -0500 Subject: [ruby/prism] Implicit rest nodes Fundamentally, `foo { |bar,| }` is different from `foo { |bar, *| }` because of arity checks. This PR introduces a new node to handle that, `ImplicitRestNode`, which goes in the `rest` slot of parameter nodes instead of `RestParameterNode` instances. This is also used in a couple of other places, namely: * pattern matching: `foo in [bar,]` * multi target: `for foo, in bar do end` * multi write: `foo, = bar` Now the only splat nodes with a `NULL` value are when you're forwarding, as in: `def foo(*) = bar(*)`. https://github.com/ruby/prism/commit/dba2a3b652 --- lib/prism/debug.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/prism') diff --git a/lib/prism/debug.rb b/lib/prism/debug.rb index d0469adc9a..adbc402f32 100644 --- a/lib/prism/debug.rb +++ b/lib/prism/debug.rb @@ -121,7 +121,7 @@ module Prism end end, *params.optionals.map(&:name), - *((params.rest.name || :*) if params.rest && params.rest.operator != ","), + *((params.rest.name || :*) if params.rest && !params.rest.is_a?(ImplicitRestNode)), *params.posts.map do |post| if post.is_a?(RequiredParameterNode) post.name -- cgit v1.2.3