Project

General

Profile

Actions

Bug #19851

closed

Ripper returns an extra block argument for :params with :args_forward

Added by thyresias (Thierry Lambert) about 1 year ago. Updated about 1 year ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x64-mingw-ucrt]
[ruby-core:114535]

Description

require 'ripper'

class BasicParser < Ripper
  EVENTS.each do |event|
    module_eval(<<~RUBY, __FILE__, __LINE__ + 1)
      def on_#{event}(*args)
        puts "#{event}(\#{args.inspect})"
        args.unshift :#{event}
        args
      end
    RUBY
  end
end

BasicParser.new('def m(...); end').parse
# stdout:
# kw(["def"])
# sp([" "])
# ident(["m"])
# lparen(["("])
# op(["..."])
# args_forward([])
# params([nil, nil, nil, nil, nil, [:args_forward], :&])

I would have expected the last :params argument to be nil, not :&.

Actions #1

Updated by thyresias (Thierry Lambert) about 1 year ago

  • Subject changed from Ripper returns and extra block argument for :params with :args_forward to Ripper returns an extra block argument for :params with :args_forward

Updated by nobu (Nobuyoshi Nakada) about 1 year ago

  • Backport changed from 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN to 3.0: DONTNEED, 3.1: REQUIRED, 3.2: REQUIRED
Actions #3

Updated by nobu (Nobuyoshi Nakada) about 1 year ago

  • Status changed from Open to Closed

Applied in changeset git|40efbc7e406699a7a5c56802233d6748bf30805b.


[Bug #19851] Ripper: Hide internal block argument ID

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0