aboutsummaryrefslogtreecommitdiff
path: root/src/jsifier.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-08-14 21:50:41 -0700
committerAlon Zakai <alonzakai@gmail.com>2011-08-14 21:50:41 -0700
commit776477fbce7e1cd52d043ec03748f912776f6b9c (patch)
treef6b8a4d9697ec637e3fac2cbdb877f9255fe725b /src/jsifier.js
parent0bd1db73469505d759256b5f3bd3227d41cc0a51 (diff)
DISABLE_EXCEPTIONS option
Diffstat (limited to 'src/jsifier.js')
-rw-r--r--src/jsifier.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 9ca0047f..078e57ea 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -685,12 +685,15 @@ function JSify(data, functionsOnly, givenFunctions, givenGlobalVariables) {
makeFuncLineActor('invoke', function(item) {
// Wrapping in a function lets us easily return values if we are
// in an assignment
+ var call_ = makeFunctionCall(item.ident, item.params, item.funcData);
+ var branch = makeBranch(item.toLabel, item.currLabelId);
+ if (DISABLE_EXCEPTIONS) return call_ + '; ' + branch;
var ret = '(function() { try { __THREW__ = false; return '
- + makeFunctionCall(item.ident, item.params, item.funcData) + ' '
+ + call_ + ' '
+ '} catch(e) { '
+ 'if (ABORT) throw e; __THREW__ = true; '
+ (EXCEPTION_DEBUG ? 'print("Exception: " + e + ", currently at: " + (new Error().stack)); ' : '')
- + 'return null } })(); if (!__THREW__) { ' + makeBranch(item.toLabel, item.currLabelId)
+ + 'return null } })(); if (!__THREW__) { ' + branch
+ ' } else { ' + makeBranch(item.unwindLabel, item.currLabelId) + ' }';
return ret;
});