Project

General

Profile

« Previous | Next » 

Revision 50ace992

Added by eileencodes (Eileen Uchitelle) over 1 year ago

[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:

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