summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-03-06 08:17:54 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-03-06 08:17:54 +0000
commitf6ed997443a1f3e0d7c3f15f0bc7b1462d7bd737 (patch)
tree74a68d0b74d4c7c4feeb903954f8d0881e742a62 /parse.y
parentbcb19975110ae9c05dedbc813da3f4c7a0bcf4c8 (diff)
* parse.y (primary): rescue and ensure clauses should be allowed
to appear in singleton method body. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y10
1 files changed, 10 insertions, 0 deletions
diff --git a/parse.y b/parse.y
index fc43dd6f28..1a64557f1a 100644
--- a/parse.y
+++ b/parse.y
@@ -1353,8 +1353,18 @@ primary : literal
}
f_arglist
compstmt
+ rescue
+ opt_else
+ ensure
kEND
{
+ if ($9) $8 = NEW_RESCUE($8, $9, $10);
+ else if ($10) {
+ rb_warn("else without rescue is useless");
+ $8 = block_append($8, $10);
+ }
+ if ($11) $8 = NEW_ENSURE($8, $11);
+
$$ = NEW_DEFS($2, $5, $7, $8);
fixpos($$, $2);
local_pop();