mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Support trailing commas in builtin
`foo(Primitive.cexpr!('Qnil'),)` causes SEGV without this change.
This commit is contained in:
parent
f8dad616c2
commit
76a0e81f40
1 changed files with 6 additions and 1 deletions
|
@ -87,7 +87,7 @@ def collect_builtin base, tree, name, bs, inlines, locals = nil
|
||||||
tree = tree[2]
|
tree = tree[2]
|
||||||
next
|
next
|
||||||
when :method_add_arg
|
when :method_add_arg
|
||||||
_, mid, (_, (_, args)) = tree
|
_method_add_arg, mid, (_arg_paren, args) = tree
|
||||||
case mid.first
|
case mid.first
|
||||||
when :call
|
when :call
|
||||||
_, recv, sep, mid = mid
|
_, recv, sep, mid = mid
|
||||||
|
@ -96,6 +96,11 @@ def collect_builtin base, tree, name, bs, inlines, locals = nil
|
||||||
else
|
else
|
||||||
mid = nil
|
mid = nil
|
||||||
end
|
end
|
||||||
|
# w/ trailing comma: [[:method_add_arg, ...]]
|
||||||
|
# w/o trailing comma: [:args_add_block, [[:method_add_arg, ...]]]
|
||||||
|
if args && args.first == :args_add_block
|
||||||
|
args = args[1]
|
||||||
|
end
|
||||||
when :vcall
|
when :vcall
|
||||||
_, mid = tree
|
_, mid = tree
|
||||||
when :command # FCALL
|
when :command # FCALL
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue