diff options
author | Anthony Pesch <inolen@gmail.com> | 2013-07-22 15:04:46 -0700 |
---|---|---|
committer | Anthony Pesch <inolen@gmail.com> | 2013-07-24 14:50:33 -0700 |
commit | 005113837b0969b193c6c485f674a132140e39d1 (patch) | |
tree | 54569fa8c79cbf0a472930ab088998e7110c7956 | |
parent | 67b321c1617bd65bf9f24702676c2fdf51e51bb4 (diff) |
eliminate default Module global
-rw-r--r-- | src/preamble.js | 2 | ||||
-rw-r--r-- | src/shell.js | 8 | ||||
-rwxr-xr-x | tests/runner.py | 6 |
3 files changed, 5 insertions, 11 deletions
diff --git a/src/preamble.js b/src/preamble.js index 41017676..ef34da6b 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -281,7 +281,7 @@ Module["ccall"] = ccall; // Returns the C function with a specified identifier (for C++, you need to do manual name mangling) function getCFunc(ident) { try { - var func = globalScope['Module']['_' + ident]; // closure exported function + var func = Module['_' + ident]; // closure exported function if (!func) func = eval('_' + ident); // explicit lookup } catch(e) { } diff --git a/src/shell.js b/src/shell.js index 1f987926..11420123 100644 --- a/src/shell.js +++ b/src/shell.js @@ -1,9 +1,4 @@ -try { - this['Module'] = Module; - Module.test; -} catch(e) { - this['Module'] = Module = {}; -} +var Module = typeof {{{ EXPORT_NAME }}} !== 'undefined' ? {{{ EXPORT_NAME }}} : {}; // The environment setup code below is customized to use Module. // *** Environment setup code *** @@ -150,4 +145,3 @@ if (!Module['postRun']) Module['postRun'] = []; {{BODY}} // {{MODULE_ADDITIONS}} - diff --git a/tests/runner.py b/tests/runner.py index 717d8914..e34fb63b 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -10316,11 +10316,11 @@ Options that are modified or new in %s include: assert 'SAFE_HEAP' not in generated, 'safe heap should not be used by default' assert ': while(' not in generated, 'when relooping we also js-optimize, so there should be no labelled whiles' if closure: - if opt_level == 0: assert 'Module._main =' in generated, 'closure compiler should have been run' - elif opt_level >= 1: assert 'Module._main=' in generated, 'closure compiler should have been run (and output should be minified)' + if opt_level == 0: assert '._main =' in generated, 'closure compiler should have been run' + elif opt_level >= 1: assert '._main=' in generated, 'closure compiler should have been run (and output should be minified)' else: # closure has not been run, we can do some additional checks. TODO: figure out how to do these even with closure - assert 'Module._main = ' not in generated, 'closure compiler should not have been run' + assert '._main = ' not in generated, 'closure compiler should not have been run' if keep_debug: assert ('(label)' in generated or '(label | 0)' in generated) == (opt_level <= 1), 'relooping should be in opt >= 2' assert ('assert(STACKTOP < STACK_MAX' in generated) == (opt_level == 0), 'assertions should be in opt == 0' |