diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-03-10 13:08:23 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-03-10 13:24:37 -0700 |
commit | 54b0f19d9e8130de16053b0915d114c346c99f17 (patch) | |
tree | c4e90ccb7192af726cd292e228e3a0e715b4b86a /src | |
parent | 501fdd709bbab7b2c11639f5a1df45123193b69b (diff) |
forward CLOSURE_COMPILER to settings, and use that to avoid a closure-specific workaround for Module detection; fixes #2209
Diffstat (limited to 'src')
-rw-r--r-- | src/settings.js | 1 | ||||
-rw-r--r-- | src/shell.js | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/settings.js b/src/settings.js index 02f6c8b5..1c41676d 100644 --- a/src/settings.js +++ b/src/settings.js @@ -133,6 +133,7 @@ var PRECISE_F32 = 0; // 0: Use JS numbers for floating-point values. These are 6 // therefore recommended. var SIMD = 0; // Whether to emit SIMD code ( https://github.com/johnmccutchan/ecmascript_simd ) +var CLOSURE_COMPILER = 0; // Whether closure compiling is being run on this output var CLOSURE_ANNOTATIONS = 0; // If set, the generated code will be annotated for the closure // compiler. This potentially lets closure optimize the code better. diff --git a/src/shell.js b/src/shell.js index 65f7b923..e1c0eb54 100644 --- a/src/shell.js +++ b/src/shell.js @@ -14,7 +14,11 @@ // before the code. Then that object will be used in the code, and you // can continue to use Module afterwards as well. var Module; +#if CLOSURE_COMPILER if (!Module) Module = eval('(function() { try { return {{{ EXPORT_NAME }}} || {} } catch(e) { return {} } })()'); +#else +if (!Module) Module = (typeof {{{ EXPORT_NAME }}} !== 'undefined' ? {{{ EXPORT_NAME }}} : null) || {}; +#endif // Sometimes an existing Module object exists with properties // meant to overwrite the default module functionality. Here |