diff options
author | Aleksander Guryanov <caiiiycuk@gmail.com> | 2013-01-12 13:29:12 +0700 |
---|---|---|
committer | Aleksander Guryanov <caiiiycuk@gmail.com> | 2013-01-17 21:16:26 +0700 |
commit | 4899a836579f064a0aa0df3b56fa15b3d4e04012 (patch) | |
tree | 0bc6283d2a5da4bdf7deb9ef75c55f4b7a0f5762 /src/jsifier.js | |
parent | b6db6d7698dcfcf7878891027c0e4b3ac31e5bda (diff) |
Implement exceptions in whitelist
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 77da7a2c..796b3806 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -1172,13 +1172,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)) { |