зеркало из https://github.com/github/ruby.git
Fix segv when parsing `command` by ripper
89cfc15207
made this event dispatch to pass `Qundef`
to user defined callback method by mistake.
This commit fix it to be `nil`.
This commit is contained in:
Родитель
38e3819be6
Коммит
39be11a17a
2
parse.y
2
parse.y
|
@ -3447,7 +3447,7 @@ command : fcall command_args %prec tLOWEST
|
|||
{
|
||||
set_embraced_location($5, &@4, &@6);
|
||||
$$ = new_command_qcall(p, idCOLON2, $1, $3, Qnull, $5, &@3, &@$);
|
||||
/*% ripper: method_add_block!(command_call!($:1, $:2, $:3, Qundef), $:5) %*/
|
||||
/*% ripper: method_add_block!(command_call!($:1, $:2, $:3, Qnil), $:5) %*/
|
||||
}
|
||||
| keyword_super command_args
|
||||
{
|
||||
|
|
|
@ -123,6 +123,21 @@ eot
|
|||
assert_equal(exp, named)
|
||||
end
|
||||
|
||||
def test_command
|
||||
sexp = Ripper.sexp("a::C {}")
|
||||
assert_equal(
|
||||
[:program,
|
||||
[
|
||||
[:method_add_block,
|
||||
[:command_call,
|
||||
[:vcall, [:@ident, "a", [1, 0]]],
|
||||
[:@op, "::", [1, 1]],
|
||||
[:@const, "C", [1, 3]],
|
||||
nil],
|
||||
[:brace_block, nil, [[:void_stmt]]]]]],
|
||||
sexp)
|
||||
end
|
||||
|
||||
def search_sexp(sym, sexp)
|
||||
return sexp if !sexp or sexp[0] == sym
|
||||
sexp.find do |e|
|
||||
|
|
Загрузка…
Ссылка в новой задаче