[Bug #20234] Fix segv when parsing begin statement in method definition
In a method definition, the begin may not have an nd_body. When that happens we get a null expr back from last_expr_node which causes a segv for the following examples:
begin
nd_body
last_expr_node
def (begin;end).foo; end def (begin;else;end).foo; end def (begin;ensure;else;end).foo; end
In addition, I've added tests for other cases that weren't causing a segv but appeared untested.`
Fixes https://bugs.ruby-lang.org/issues/20234
[Bug #20234] Fix segv when parsing begin statement in method definition
In a method definition, the
begin
may not have annd_body
. When thathappens we get a null expr back from
last_expr_node
which causes asegv for the following examples:
In addition, I've added tests for other cases that weren't causing a
segv but appeared untested.`
Fixes https://bugs.ruby-lang.org/issues/20234