evanphx (owner)

Revisions

gist: 205560 Download_button fork
public
Public Clone URL: git://gist.github.com/205560.git
Embed All Files: show embed
Text #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
diff --git a/lib/compiler-ng/ast/exceptions.rb b/lib/compiler-ng/ast/exceptions.rb
index 0ef7f54..077143e 100644
--- a/lib/compiler-ng/ast/exceptions.rb
+++ b/lib/compiler-ng/ast/exceptions.rb
@@ -126,10 +126,30 @@ module Rubinius
           # TODO: ?
           g.new_label.set!
 
+ if current_break = g.break
+ # Make a break available to use, which we'll use to
+ # lazily generate a cleanup area
+ g.break = g.new_label
+ end
+
           @body.bytecode(g)
           g.pop_unwind
           g.goto els
 
+ if current_break
+ if g.break.used?
+ g.break.set!
+ g.pop_unwind
+
+ # Reset the outer exception
+ g.swap
+ g.pop_exception
+ g.goto current_break
+ end
+
+ g.break = current_break
+ end
+
           ex.set!
           @rescue.bytecode(g, reraise, done)
           reraise.set!