diff options
author | Jukka Jylänki <jujjyl@gmail.com> | 2013-11-04 14:07:02 +0200 |
---|---|---|
committer | Jukka Jylänki <jujjyl@gmail.com> | 2013-11-04 14:07:02 +0200 |
commit | 8a419cd95dad82f649f16d339dbbe3de3bb0db32 (patch) | |
tree | b029447e18f5dd13c9ff9777f92e594f3c6b6bb6 /src/shell.js | |
parent | a9ef49d8c97dcaed3cc7778acf61de978efdd5ff (diff) |
Give names to most manually assigned functions in the .js files, in form "var x = function()" -> "function x()" so that error stack traces and profiling stack traces are more informative and do not contain anonymous functions.
Diffstat (limited to 'src/shell.js')
-rw-r--r-- | src/shell.js | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/shell.js b/src/shell.js index be23b3c1..b68e16d9 100644 --- a/src/shell.js +++ b/src/shell.js @@ -38,17 +38,17 @@ var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIR if (ENVIRONMENT_IS_NODE) { // Expose functionality in the same simple way that the shells work // Note that we pollute the global namespace here, otherwise we break in node - Module['print'] = function(x) { + Module['print'] = function print(x) { process['stdout'].write(x + '\n'); }; - Module['printErr'] = function(x) { + Module['printErr'] = function printErr(x) { process['stderr'].write(x + '\n'); }; var nodeFS = require('fs'); var nodePath = require('path'); - Module['read'] = function(filename, binary) { + Module['read'] = function read(filename, binary) { filename = nodePath['normalize'](filename); var ret = nodeFS['readFileSync'](filename); // The path is absolute if the normalized version is the same as the resolved. @@ -60,9 +60,9 @@ if (ENVIRONMENT_IS_NODE) { return ret; }; - Module['readBinary'] = function(filename) { return Module['read'](filename, true) }; + Module['readBinary'] = function readBinary(filename) { return Module['read'](filename, true) }; - Module['load'] = function(f) { + Module['load'] = function load(f) { globalEval(read(f)); }; @@ -77,10 +77,10 @@ else if (ENVIRONMENT_IS_SHELL) { if (typeof read != 'undefined') { Module['read'] = read; } else { - Module['read'] = function() { throw 'no read() available (jsc?)' }; + Module['read'] = function read() { throw 'no read() available (jsc?)' }; } - Module['readBinary'] = function(f) { + Module['readBinary'] = function readBinary(f) { return read(f, 'binary'); }; @@ -93,7 +93,7 @@ else if (ENVIRONMENT_IS_SHELL) { this['{{{ EXPORT_NAME }}}'] = Module; } else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { - Module['read'] = function(url) { + Module['read'] = function read(url) { var xhr = new XMLHttpRequest(); xhr.open('GET', url, false); xhr.send(null); @@ -105,10 +105,10 @@ else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { } if (typeof console !== 'undefined') { - Module['print'] = function(x) { + Module['print'] = function print(x) { console.log(x); }; - Module['printErr'] = function(x) { + Module['printErr'] = function printErr(x) { console.log(x); }; } else { @@ -136,7 +136,7 @@ function globalEval(x) { eval.call(null, x); } if (!Module['load'] == 'undefined' && Module['read']) { - Module['load'] = function(f) { + Module['load'] = function load(f) { globalEval(Module['read'](f)); }; } |