зеркало из https://github.com/github/ruby.git
parse.y: fix block passing with empty kwargs
* parse.y (arg_blk_pass): preceeding arguments node may be NULL when an empty keyword argument hash splat is optimized away. [ruby-core:88890] [Bug #15087] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
b06bcff42d
Коммит
d325d74174
1
parse.y
1
parse.y
|
@ -9962,6 +9962,7 @@ static NODE *
|
|||
arg_blk_pass(NODE *node1, NODE *node2)
|
||||
{
|
||||
if (node2) {
|
||||
if (!node1) return node2;
|
||||
node2->nd_head = node1;
|
||||
nd_set_first_lineno(node2, nd_first_lineno(node1));
|
||||
nd_set_first_column(node2, nd_first_column(node1));
|
||||
|
|
|
@ -563,7 +563,8 @@ class TestKeywordArguments < Test::Unit::TestCase
|
|||
|
||||
def test_dynamic_symbol_keyword
|
||||
bug10266 = '[ruby-dev:48564] [Bug #10266]'
|
||||
assert_separately(['-', bug10266], <<-'end;') # do
|
||||
assert_separately(['-', bug10266], "#{<<~"begin;"}\n#{<<~'end;'}")
|
||||
begin;
|
||||
bug = ARGV.shift
|
||||
"hoge".to_sym
|
||||
assert_nothing_raised(bug) {eval("def a(hoge:); end")}
|
||||
|
@ -746,4 +747,8 @@ class TestKeywordArguments < Test::Unit::TestCase
|
|||
|
||||
assert_equal(:ok, many_kwargs(e0: :ok)[i], "#{i}: e0"); i+=1
|
||||
end
|
||||
|
||||
def test_splat_empty_hash_with_block_passing
|
||||
assert_valid_syntax("bug15087(**{}, &nil)")
|
||||
end
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче