Project

General

Profile

Actions

Bug #15673

closed

Number args + Ripper

Added by kddnewton (Kevin Newton) about 5 years ago. Updated about 5 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.7.0dev (2019-03-18 trunk 67295) [x86_64-darwin18]
[ruby-core:91867]

Description

Hi there -

Love the new number args for blocks. When I run

[1, 2, 3].map { @1 * 2 }

everything works. However, when I run:

require 'ripper'; Ripper.new('[1, 2, 3].map { @1 * 2 }').parse

it returns nothing and says there's an error.


Files

ripper.patch (824 Bytes) ripper.patch kddnewton (Kevin Newton), 03/18/2019 07:33 PM

Updated by kddnewton (Kevin Newton) about 5 years ago

To be clear, I mean that:

require 'ripper'; Ripper.new('[1, 2, 3].map { @1 * 2 }').tap(&:parse).error?

returns true

Updated by kddnewton (Kevin Newton) about 5 years ago

Some more investigation yields that compile_error is called with:

identifier false is not valid to get

Updated by kddnewton (Kevin Newton) about 5 years ago

I think I found it. I've attached a patch file. Please forgive me if I'm doing this wrong, this is my first contribution.

Actions #4

Updated by nobu (Nobuyoshi Nakada) about 5 years ago

  • Status changed from Open to Closed

Applied in changeset trunk|r67306.


parse.y: fix var_ref of numbered param in ripper

  • parse.y (string_dvar, user_variable): register numbered
    parameter in ripper for var_ref.
    [ruby-core:91867] [Bug #15673]
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0