diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-01-17 18:38:25 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-01-17 18:38:25 -0800 |
commit | 2913e6efd9acd4180847ed1f3ed84d450e8719de (patch) | |
tree | 9cbd74e4331eb5ca1c7787ecd31da247219ecdbb /src/jsifier.js | |
parent | 33b7ca2795983813467d796edb8dd9d380a288bd (diff) | |
parent | 4899a836579f064a0aa0df3b56fa15b3d4e04012 (diff) |
Merge pull request #778 from caiiiycuk/exception_catching_in_scope
Implement exceptions in scopes
Diffstat (limited to 'src/jsifier.js')
-rw-r--r-- | src/jsifier.js | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index 5763b690..a575ea95 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -1171,13 +1171,22 @@ function JSify(data, functionsOnly, givenFunctions) { // in an assignment var phiSets = calcPhiSets(item); var call_ = makeFunctionCall(item.ident, item.params, item.funcData, item.type); - var ret = '(function() { try { __THREW__ = 0; return ' - + call_ + ' ' - + '} catch(e) { ' - + 'if (typeof e != "number") throw e; ' - + 'if (ABORT) throw e; __THREW__ = 1; ' - + (EXCEPTION_DEBUG ? 'Module.print("Exception: " + e + ", currently at: " + (new Error().stack)); ' : '') - + 'return null } })();'; + + var ret; + + if (DISABLE_EXCEPTION_CATCHING == 2 && !(item.funcData.ident in EXCEPTION_CATCHING_WHITELIST)) { + ret = call_ + ';'; + } else { + ret = '(function() { try { __THREW__ = 0; return ' + + call_ + ' ' + + '} catch(e) { ' + + 'if (typeof e != "number") throw e; ' + + 'if (ABORT) throw e; __THREW__ = 1; ' + + (EXCEPTION_DEBUG ? 'Module.print("Exception: " + e + ", currently at: " + (new Error().stack)); ' : '') + + 'return null } })();'; + } + + if (item.assignTo) { ret = 'var ' + item.assignTo + ' = ' + ret; if (USE_TYPED_ARRAYS == 2 && isIllegalType(item.type)) { |