diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-11-08 16:01:27 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-11-08 16:04:05 -0800 |
commit | b873dc778f52461129b1e28fb12dd3d4a309851c (patch) | |
tree | e82913bc549a83104ce8abfb518eca6cb6d8aa83 /src/shell.js | |
parent | 140ea9e81feb09d8f2559995c73d49a39424ef5d (diff) | |
parent | e0268fa1035a718341c53921eee9318d4a8033cd (diff) |
Merge branch 'incoming' into f32
Conflicts:
src/parseTools.js
src/preamble.js
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)); }; } |