diff options
author | Anthony Pesch <inolen@gmail.com> | 2013-08-09 12:29:41 -0700 |
---|---|---|
committer | Anthony Pesch <inolen@gmail.com> | 2013-08-09 12:29:41 -0700 |
commit | 39cf1e36ab14c621f1e446010afbec21a8b10dbb (patch) | |
tree | 7486ddf0d651853341d6ad40f2bdd97e9b3bd28b /src/postamble.js | |
parent | a9bb2f0261fd88048d7e499df33808a23884cb02 (diff) |
use instanceof operator for detecting ExitStatus throw
Diffstat (limited to 'src/postamble.js')
-rw-r--r-- | src/postamble.js | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/postamble.js b/src/postamble.js index ad265b32..c4ca3aae 100644 --- a/src/postamble.js +++ b/src/postamble.js @@ -1,6 +1,14 @@ // === Auto-generated postamble setup entry stuff === +function ExitStatus(status) { + this.name = "ExitStatus"; + this.message = "Program terminated with exit(" + status + ")"; + this.status = status; +}; +ExitStatus.prototype = new Error(); +ExitStatus.prototype.constructor = ExitStatus; + var initialStackTop; Module['callMain'] = Module.callMain = function callMain(args) { @@ -45,7 +53,7 @@ Module['callMain'] = Module.callMain = function callMain(args) { } } catch(e) { - if (e.name == 'ExitStatus') { + if (e instanceof ExitStatus) { // exit() throws this once it's done to make sure execution // has been stopped completely return; @@ -112,14 +120,7 @@ function exit(status) { exitRuntime(); // throw an exception to halt the current execution - function ExitStatus() { - this.name = "ExitStatus"; - this.message = "Program terminated with exit(" + status + ")"; - this.status = status; - }; - ExitStatus.prototype = new Error(); - ExitStatus.prototype.constructor = ExitStatus; - throw new ExitStatus(); + throw new ExitStatus(status); } Module['exit'] = Module.exit = exit; |