Skip to content

Commit 1392600

Browse files
committed
[Bug #21983] Make &nil distinguishable from nonexistent block arg
1 parent 42e0660 commit 1392600

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

ast.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ node_children(VALUE ast_value, const NODE *node)
698698
: var_name(ainfo->rest_arg)),
699699
(ainfo->no_kwarg ? Qfalse : NEW_CHILD(ast_value, (NODE *)ainfo->kw_args)),
700700
(ainfo->no_kwarg ? Qfalse : NEW_CHILD(ast_value, ainfo->kw_rest_arg)),
701-
var_name(ainfo->block_arg));
701+
(ainfo->no_blockarg ? Qfalse : var_name(ainfo->block_arg)));
702702
}
703703
case NODE_SCOPE:
704704
{

test/ruby/test_ast.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,7 @@ def test_block_arg
720720
assert_equal(nil, block_arg.call(''))
721721
assert_equal(:block, block_arg.call('&block'))
722722
assert_equal(:&, block_arg.call('&'))
723+
assert_equal(false, block_arg.call('&nil'))
723724
end
724725

725726
def test_keyword_rest

0 commit comments

Comments
 (0)