Browse files

Fix return from try/catch blocks expressions in finallyblock, bug 717…

…170. r=amasad
  • Loading branch information...
1 parent 34020e0 commit 259b12cf31923cf93d0b47d5adaa0b996680c8d4 @amasad committed Jan 11, 2012
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/jsexec.js
View
5 lib/jsexec.js
@@ -654,8 +654,13 @@ Narcissus.interpreter = (function() {
}
}
} finally {
+ // We may already be returning something from the try or catch
+ // blocks so save result incase of changes from the
+ // finallyBlock.
+ t = x.result;
if (n.finallyBlock)
execute(n.finallyBlock, x);
+ x.result = t;
}
break;

1 comment on commit 259b12c

@dherman

Seems at least less buggy than what we currently do. :) I have to study our finally implementation more carefully to figure out how far we are from the correct semantics. But this looks about right.

Thanks for the patch!

Please sign in to comment.