Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse stabby lambda args same as Kernel#lambda #189

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions lib/ruby19_parser.y
Expand Up @@ -1382,8 +1382,6 @@ rule
lpar, args, body = val
lexer.lpar_beg = lpar

args = 0 if args == s(:args)

call = new_call nil, :lambda
result = new_iter call, args, body
}
Expand Down
2 changes: 0 additions & 2 deletions lib/ruby_parser.yy
Expand Up @@ -1482,8 +1482,6 @@ opt_block_args_tail: tCOMMA block_args_tail
lpar, args, body = val
lexer.lpar_beg = lpar

args = 0 if args == s(:args)

call = new_call nil, :lambda
result = new_iter call, args, body
self.env.unextend
Expand Down
6 changes: 3 additions & 3 deletions test/test_ruby_parser.rb
Expand Up @@ -2019,9 +2019,9 @@ def test_call_assoc_new
assert_parse rb, pt
end

def test_do_lambda
def test_do_lambda_no_args
rb = "->() do end"
pt = s(:iter, s(:call, nil, :lambda), 0)
pt = s(:iter, s(:call, nil, :lambda), s(:args))

assert_parse rb, pt
end
Expand Down Expand Up @@ -3036,7 +3036,7 @@ def test_index_0
end

def test_lambda_do_vs_brace
pt = s(:call, nil, :f, s(:iter, s(:call, nil, :lambda), 0))
pt = s(:call, nil, :f, s(:iter, s(:call, nil, :lambda), s(:args)))

rb = "f ->() {}"
assert_parse rb, pt
Expand Down