From b0f115da1a8952e2328e3ef872bb2903c45ed96f Mon Sep 17 00:00:00 2001 From: mame Date: Sun, 10 Jul 2011 02:42:07 +0000 Subject: [PATCH] * parse.y (reduce_nodes_gen): NODE_RETURN in rescue body must not be reduced when there is an else clause. This caused bizarre behavior in [Bug #4473] [ruby-core:35629] [ruby-core:37884]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32483 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ parse.y | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2c8032ec1e..5f474db4b4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sun Jul 10 11:35:29 2011 Yusuke Endoh + + * parse.y (reduce_nodes_gen): NODE_RETURN in rescue body must not be + reduced when there is an else clause. This caused bizarre behavior + in [Bug #4473] [ruby-core:35629] [ruby-core:37884]. + Sun Jul 10 09:46:14 2011 Masaya Tarui * range.c (range_max): fix behavior with excluded end value. diff --git a/parse.y b/parse.y index 9769bb9887..ffa649b7af 100644 --- a/parse.y +++ b/parse.y @@ -8713,6 +8713,10 @@ reduce_nodes_gen(struct parser_params *parser, NODE **body) if (!subnodes(nd_head, nd_resq)) goto end; break; case NODE_RESCUE: + if (node->nd_else) { + body = &node->nd_resq; + break; + } if (!subnodes(nd_head, nd_resq)) goto end; break; default: