the exception handler consumes both the exception and the machine.

This commit is contained in:
Danny Yoo 2011-03-24 18:46:34 -04:00
parent 7c7491329c
commit e5ff0e227c
2 changed files with 5 additions and 5 deletions

View File

@ -26,8 +26,8 @@
(displayln (assemble-basic-block basic-block) op) (displayln (assemble-basic-block basic-block) op)
(newline op)) (newline op))
basic-blocks) basic-blocks)
(fprintf op "MACHINE.params.currentErrorHandler = function(e) { fail(e); };\n") (fprintf op "MACHINE.params.currentErrorHandler = fail;\n")
(fprintf op "MACHINE.params.currentSuccessHandler = function(MACHINE) { success(MACHINE.val); };\n") (fprintf op "MACHINE.params.currentSuccessHandler = success;\n")
(fprintf op #<<EOF (fprintf op #<<EOF
for (param in params) { for (param in params) {
if (params.hasOwnProperty(param)) { if (params.hasOwnProperty(param)) {

View File

@ -309,8 +309,8 @@ var MACHINE = { callsBeforeTrampoline: 100,
running : false, running : false,
params: { currentDisplayer: function(v) {}, params: { currentDisplayer: function(v) {},
currentSuccessHandler: function(v) {}, currentSuccessHandler: function(MACHINE) {},
currentErrorHandler: function(e) {}, currentErrorHandler: function(MACHINE, exn) {},
currentNamespace: {}, currentNamespace: {},
@ -379,7 +379,7 @@ var trampoline = function(MACHINE, initialJump) {
} }
} else { } else {
MACHINE.running = false; MACHINE.running = false;
return MACHINE.params.currentErrorHandler(e); return MACHINE.params.currentErrorHandler(MACHINE, e);
} }
} }
} }