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:
yui-knk 2024-04-10 10:28:51 +09:00 коммит произвёл Yuichiro Kaneko
Родитель 38e3819be6
Коммит 39be11a17a
2 изменённых файлов: 16 добавлений и 1 удалений

Просмотреть файл

@ -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|