diff --git a/src/modularize.js b/src/modularize.js index e6af07b5d813e..9b4b99e6265cd 100644 --- a/src/modularize.js +++ b/src/modularize.js @@ -7,6 +7,10 @@ // This code implements the `-sMODULARIZE` settings by taking the generated // JS program code (INNER_JS_CODE) and wrapping it in a factory function. +#if STRICT_JS +"use strict"; +#endif + #if SOURCE_PHASE_IMPORTS import source wasmModule from './{{{ WASM_BINARY_FILE }}}'; #endif diff --git a/src/shell.js b/src/shell.js index ec40ac6cf3412..41294749487a4 100644 --- a/src/shell.js +++ b/src/shell.js @@ -3,9 +3,8 @@ * Copyright 2010 The Emscripten Authors * SPDX-License-Identifier: MIT */ -#if STRICT_JS +#if STRICT_JS && !MODULARIZE // MODULARIZE handles this itself "use strict"; - #endif #include "minimum_runtime_check.js" diff --git a/test/test_core.py b/test/test_core.py index a55bf02c9b970..29b1015c2de84 100644 --- a/test/test_core.py +++ b/test/test_core.py @@ -6306,7 +6306,6 @@ def test_jslib(self): @with_env_modify({'LC_ALL': 'latin-1', 'PYTHONUTF8': '0', 'PYTHONCOERCECLOCALE': '0'}) @crossplatform @no_modularize_instance('uses MODULARIZE') - @no_strict_js('MODULARIZE is not compatible with STRICT_JS') @no_omit_asm_module_exports('MODULARIZE is not compatible with DECLARE_ASM_MODULE_EXPORTS=0') def test_unicode_js_library(self): # First verify that we have correct overridden the default python file encoding. @@ -8038,7 +8037,6 @@ def get_wat_addr(call_index): @no_omit_asm_module_exports('MODULARIZE is not compatible with DECLARE_ASM_MODULE_EXPORTS=0') @no_modularize_instance('uses -sMODULARIZE') - @no_strict_js('MODULARIZE is not compatible with STRICT_JS') def test_modularize_closure_pre(self): # test that the combination of modularize + closure + pre-js works. in that mode, # closure should not minify the Module object in a way that the pre-js cannot use it. @@ -8985,7 +8983,6 @@ def test_asan_api(self): self.do_core_test('test_asan_api.c', cflags=['-fsanitize=address']) @asan - @no_strict_js('MODULARIZE is not compatible with STRICT_JS') @no_omit_asm_module_exports('MODULARIZE is not compatible with DECLARE_ASM_MODULE_EXPORTS=0') @no_modularize_instance('uses MODULARIZE') def test_asan_modularized_with_closure(self): @@ -9680,7 +9677,7 @@ def test_esm_integration(self): self.assertFileContents(test_file('core/test_esm_integration.expected.mjs'), read_file('hello_world.mjs')) @no_omit_asm_module_exports('MODULARIZE is not compatible with DECLARE_ASM_MODULE_EXPORTS=0') - @no_strict_js('MODULARIZE is not compatible with STRICT_JS') + @no_strict_js('EXPORT_ES6 is not compatible with STRICT_JS') def test_modularize_instance_hello(self): self.do_core_test('test_hello_world.c', cflags=['-sMODULARIZE=instance', '-Wno-experimental']) @@ -9689,7 +9686,7 @@ def test_modularize_instance_hello(self): 'pthreads': (['-pthread'],), }) @no_omit_asm_module_exports('MODULARIZE is not compatible with DECLARE_ASM_MODULE_EXPORTS=0') - @no_strict_js('MODULARIZE is not compatible with STRICT_JS') + @no_strict_js('EXPORT_ES6 is not compatible with STRICT_JS') def test_modularize_instance(self, args): if args: self.require_pthreads() @@ -9725,7 +9722,7 @@ def test_modularize_instance(self, args): @no_omit_asm_module_exports('MODULARIZE is not compatible with DECLARE_ASM_MODULE_EXPORTS=0') @no_4gb('EMBIND_AOT can\'t lower 4gb') - @no_strict_js('MODULARIZE is not compatible with STRICT_JS') + @no_strict_js('EXPORT_ES6 is not compatible with STRICT_JS') def test_modularize_instance_embind(self): self.run_process([EMXX, test_file('modularize_instance_embind.cpp'), '-sMODULARIZE=instance', diff --git a/tools/link.py b/tools/link.py index 451a6541a1de0..bf8557e3ea27b 100644 --- a/tools/link.py +++ b/tools/link.py @@ -1148,7 +1148,7 @@ def limit_incoming_module_api(): diagnostics.warning('unused-command-line-argument', '--shell-file ignored when not generating html output') if settings.STRICT: - if not settings.MODULARIZE: + if not settings.EXPORT_ES6: default_setting('STRICT_JS', 1) default_setting('DEFAULT_TO_CXX', 0) default_setting('IGNORE_MISSING_MAIN', 0) diff --git a/tools/settings.py b/tools/settings.py index 7fa264282024d..2cbdc8e04a052 100644 --- a/tools/settings.py +++ b/tools/settings.py @@ -135,7 +135,6 @@ ('PTHREADS_PROFILING', 'NO_ASSERTIONS', 'only works with ASSERTIONS enabled'), ('SOURCE_PHASE_IMPORTS', 'NO_EXPORT_ES6', None), ('STANDALONE_WASM', 'MINIMAL_RUNTIME', None), - ('STRICT_JS', 'MODULARIZE', None), ('STRICT_JS', 'EXPORT_ES6', None), ('MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION', 'MINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION', 'they are mutually exclusive'), ('MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION', 'SINGLE_FILE', None),