提交 96c5bd18 编写于 作者: J Justin Collins

Merge branch 'block_args_for_stabby_lambdas'

......@@ -371,7 +371,11 @@ class Sexp
# s(:call, nil, :p, s(:arglist, s(:lvar, :y))))
def block_args
expect :iter, :call_with_block
self[2]
if self[2] == 0 # ?! See https://github.com/presidentbeef/brakeman/issues/331
return Sexp.new(:args)
else
self[2]
end
end
def first_param
......
......@@ -87,6 +87,15 @@ class SexpTests < Test::Unit::TestCase
assert_equal s(:call, nil, :blah, s(:lvar, :z)), block
end
def test_stabby_lambda_no_args
exp = parse "->{ hi }"
args = exp.block_args
assert_equal s(:call, nil, :lambda), exp.block_call
assert_equal s(:args), exp.block_args
assert_equal s(:call, nil, :hi), exp.block
end
def test_or
exp = parse '1 or 2'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册