Skip to content
Permalink
Browse files
[Truffle] Fix what happens when you raise an exception in 'else'.
  • Loading branch information
chrisseaton committed Dec 6, 2014
1 parent 3cbe259 commit e17ec0665d2224c688574774c59c39294005e1c8
@@ -46,11 +46,10 @@ public Object execute(VirtualFrame frame) {
while (true) {
getContext().getSafepointManager().poll();

Object result;

try {
final Object result = tryPart.execute(frame);
elseProfile.enter();
elsePart.executeVoid(frame);
return result;
result = tryPart.execute(frame);
} catch (ControlFlowException exception) {
controlFlowProfile.enter();
throw exception;
@@ -63,6 +62,10 @@ public Object execute(VirtualFrame frame) {
continue;
}
}

elseProfile.enter();
elsePart.executeVoid(frame);
return result;
}
}

@@ -68,3 +68,7 @@ fails:"A method assigns local variables from method parameters for definition \n
fails:"A method assigns local variables from method parameters for definition \n def m(**k, &b) [k, b] end"
fails:"A method assigns local variables from method parameters for definition \n def m(a, b=1, *c, (*d, (e)), f: 2, g:, h:, **k, &l)\n [a, b, c, d, e, f, g, h, k, l]\n end"
fails:"A method assigns local variables from method parameters for definition \n def m a, b=1, *c, d, e:, f: 2, g:, **k, &l\n [a, b, c, d, e, f, g, k, l]\n end"
fails:"A method assigns local variables from method parameters for definition \n def m(a, (b, c)) [a, b, c] end"
fails:"A method assigns local variables from method parameters for definition \n def m((a, b), (c, d))\n [a, b, c, d]\n end"
fails:"A method assigns local variables from method parameters for definition \n def m(a=1, (b, c)) [a, b, c] end"
fails:"A method assigns local variables from method parameters for definition \n def m(a=1, (b, c), (d, e)) [a, b, c, d, e] end"
@@ -1,3 +1,2 @@
fails:The rescue keyword will not rescue errors raised in an else block in the rescue block above it
fails:The rescue keyword can rescue a splatted list of exceptions
fails:The rescue keyword will only rescue the specified exceptions when doing a splat rescue

0 comments on commit e17ec06

Please sign in to comment.