Project

General

Profile

Bug #15673

Number args + Ripper

Added by kddeisz (Kevin Deisz) 8 months ago. Updated 8 months ago.

Status:
Closed
Priority:
Normal
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 kddeisz (Kevin Deisz), 03/18/2019 07:33 PM

Associated revisions

Revision fa66569a
Added by nobu (Nobuyoshi Nakada) 8 months ago

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]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 67306
Added by nobu (Nobuyoshi Nakada) 8 months ago

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]

History

Updated by kddeisz (Kevin Deisz) 8 months ago

To be clear, I mean that:

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

returns true

Updated by kddeisz (Kevin Deisz) 8 months ago

Some more investigation yields that compile_error is called with:

identifier false is not valid to get

Updated by kddeisz (Kevin Deisz) 8 months 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.

#4

Updated by nobu (Nobuyoshi Nakada) 8 months 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]

Also available in: Atom PDF