Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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: ```ruby 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
- Loading branch information