Skip to content

Commit d6cfd73

Browse files
authored
Allow STRICT_JS in MODULARIZE mode. NFC (#26424)
Its still not allowed in `EXPORT_ES6` mode where its the default. Split out from #26421
1 parent 3051725 commit d6cfd73

File tree

5 files changed

+9
-10
lines changed

5 files changed

+9
-10
lines changed

src/modularize.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
// This code implements the `-sMODULARIZE` settings by taking the generated
88
// JS program code (INNER_JS_CODE) and wrapping it in a factory function.
99

10+
#if STRICT_JS
11+
"use strict";
12+
#endif
13+
1014
#if SOURCE_PHASE_IMPORTS
1115
import source wasmModule from './{{{ WASM_BINARY_FILE }}}';
1216
#endif

src/shell.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
* Copyright 2010 The Emscripten Authors
44
* SPDX-License-Identifier: MIT
55
*/
6-
#if STRICT_JS
6+
#if STRICT_JS && !MODULARIZE // MODULARIZE handles this itself
77
"use strict";
8-
98
#endif
109

1110
#include "minimum_runtime_check.js"

test/test_core.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6306,7 +6306,6 @@ def test_jslib(self):
63066306
@with_env_modify({'LC_ALL': 'latin-1', 'PYTHONUTF8': '0', 'PYTHONCOERCECLOCALE': '0'})
63076307
@crossplatform
63086308
@no_modularize_instance('uses MODULARIZE')
6309-
@no_strict_js('MODULARIZE is not compatible with STRICT_JS')
63106309
@no_omit_asm_module_exports('MODULARIZE is not compatible with DECLARE_ASM_MODULE_EXPORTS=0')
63116310
def test_unicode_js_library(self):
63126311
# First verify that we have correct overridden the default python file encoding.
@@ -8038,7 +8037,6 @@ def get_wat_addr(call_index):
80388037

80398038
@no_omit_asm_module_exports('MODULARIZE is not compatible with DECLARE_ASM_MODULE_EXPORTS=0')
80408039
@no_modularize_instance('uses -sMODULARIZE')
8041-
@no_strict_js('MODULARIZE is not compatible with STRICT_JS')
80428040
def test_modularize_closure_pre(self):
80438041
# test that the combination of modularize + closure + pre-js works. in that mode,
80448042
# 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):
89858983
self.do_core_test('test_asan_api.c', cflags=['-fsanitize=address'])
89868984

89878985
@asan
8988-
@no_strict_js('MODULARIZE is not compatible with STRICT_JS')
89898986
@no_omit_asm_module_exports('MODULARIZE is not compatible with DECLARE_ASM_MODULE_EXPORTS=0')
89908987
@no_modularize_instance('uses MODULARIZE')
89918988
def test_asan_modularized_with_closure(self):
@@ -9677,7 +9674,7 @@ def test_esm_integration(self):
96779674
self.assertFileContents(test_file('core/test_esm_integration.expected.mjs'), read_file('hello_world.mjs'))
96789675

96799676
@no_omit_asm_module_exports('MODULARIZE is not compatible with DECLARE_ASM_MODULE_EXPORTS=0')
9680-
@no_strict_js('MODULARIZE is not compatible with STRICT_JS')
9677+
@no_strict_js('EXPORT_ES6 is not compatible with STRICT_JS')
96819678
def test_modularize_instance_hello(self):
96829679
self.do_core_test('test_hello_world.c', cflags=['-sMODULARIZE=instance', '-Wno-experimental'])
96839680

@@ -9686,7 +9683,7 @@ def test_modularize_instance_hello(self):
96869683
'pthreads': (['-pthread'],),
96879684
})
96889685
@no_omit_asm_module_exports('MODULARIZE is not compatible with DECLARE_ASM_MODULE_EXPORTS=0')
9689-
@no_strict_js('MODULARIZE is not compatible with STRICT_JS')
9686+
@no_strict_js('EXPORT_ES6 is not compatible with STRICT_JS')
96909687
def test_modularize_instance(self, args):
96919688
if args:
96929689
self.require_pthreads()
@@ -9722,7 +9719,7 @@ def test_modularize_instance(self, args):
97229719

97239720
@no_omit_asm_module_exports('MODULARIZE is not compatible with DECLARE_ASM_MODULE_EXPORTS=0')
97249721
@no_4gb('EMBIND_AOT can\'t lower 4gb')
9725-
@no_strict_js('MODULARIZE is not compatible with STRICT_JS')
9722+
@no_strict_js('EXPORT_ES6 is not compatible with STRICT_JS')
97269723
def test_modularize_instance_embind(self):
97279724
self.run_process([EMXX, test_file('modularize_instance_embind.cpp'),
97289725
'-sMODULARIZE=instance',

tools/link.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1148,7 +1148,7 @@ def limit_incoming_module_api():
11481148
diagnostics.warning('unused-command-line-argument', '--shell-file ignored when not generating html output')
11491149

11501150
if settings.STRICT:
1151-
if not settings.MODULARIZE:
1151+
if not settings.EXPORT_ES6:
11521152
default_setting('STRICT_JS', 1)
11531153
default_setting('DEFAULT_TO_CXX', 0)
11541154
default_setting('IGNORE_MISSING_MAIN', 0)

tools/settings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@
135135
('PTHREADS_PROFILING', 'NO_ASSERTIONS', 'only works with ASSERTIONS enabled'),
136136
('SOURCE_PHASE_IMPORTS', 'NO_EXPORT_ES6', None),
137137
('STANDALONE_WASM', 'MINIMAL_RUNTIME', None),
138-
('STRICT_JS', 'MODULARIZE', None),
139138
('STRICT_JS', 'EXPORT_ES6', None),
140139
('MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION', 'MINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION', 'they are mutually exclusive'),
141140
('MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION', 'SINGLE_FILE', None),

0 commit comments

Comments
 (0)