mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
fix "&" handling in block parameter.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5fe865d0ac
commit
c710449a85
1 changed files with 8 additions and 6 deletions
|
@ -211,11 +211,6 @@ class TestRubyYieldGen < Test::Unit::TestCase
|
||||||
params.pop
|
params.pop
|
||||||
end
|
end
|
||||||
|
|
||||||
if params.last && params.last[0] == '&'
|
|
||||||
result_binding[params.last[1]] = nil
|
|
||||||
params.pop
|
|
||||||
end
|
|
||||||
|
|
||||||
star_index = nil
|
star_index = nil
|
||||||
params.each_with_index {|par, i|
|
params.each_with_index {|par, i|
|
||||||
star_index = i if par[0] == '*'
|
star_index = i if par[0] == '*'
|
||||||
|
@ -268,12 +263,19 @@ class TestRubyYieldGen < Test::Unit::TestCase
|
||||||
|
|
||||||
#p [:emu0, args, params]
|
#p [:emu0, args, params]
|
||||||
|
|
||||||
|
result_binding = {}
|
||||||
|
|
||||||
|
if params.last && params.last[0] == '&'
|
||||||
|
result_binding[params.last[1]] = nil
|
||||||
|
params.pop
|
||||||
|
end
|
||||||
|
|
||||||
# TRICK #1 : single array argument is expanded if there are two or more params.
|
# TRICK #1 : single array argument is expanded if there are two or more params.
|
||||||
if args.length == 1 && Array === args[0] && 1 < params.length
|
if args.length == 1 && Array === args[0] && 1 < params.length
|
||||||
args = args[0]
|
args = args[0]
|
||||||
end
|
end
|
||||||
|
|
||||||
result_binding = emu_bind_params(args, params)
|
emu_bind_params(args, params, result_binding)
|
||||||
#p result_binding
|
#p result_binding
|
||||||
result_binding
|
result_binding
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue