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)
(newline op))
basic-blocks)
(fprintf op "MACHINE.params.currentErrorHandler = function(e) { fail(e); };\n")
(fprintf op "MACHINE.params.currentSuccessHandler = function(MACHINE) { success(MACHINE.val); };\n")
(fprintf op "MACHINE.params.currentErrorHandler = fail;\n")
(fprintf op "MACHINE.params.currentSuccessHandler = success;\n")
(fprintf op #<<EOF
for (param in params) {
if (params.hasOwnProperty(param)) {

View File

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