diff --git a/test/common.py b/test/common.py index 18e785fe8e4d3..88dc4b97ead63 100644 --- a/test/common.py +++ b/test/common.py @@ -1551,7 +1551,9 @@ def check_expected_size_in_file(self, desc, filename, size): expected_size = int(read_file(filename).strip()) delta = size - expected_size ratio = abs(delta) / float(expected_size) - print(' seen %s size: %d (expected: %d) (delta: %d), ratio to expected: %f' % (desc, size, expected_size, delta, ratio)) + print( + ' seen %s size: %d (expected: %d) (delta: %d), ratio to expected: %f' % (desc, size, expected_size, delta, ratio) + ) self.assertLess(ratio, size_slack) library_cache: Dict[str, Tuple[str, object]] = {} diff --git a/test/test_browser.py b/test/test_browser.py index 76619cb8e9c48..d6f423a2b30c1 100644 --- a/test/test_browser.py +++ b/test/test_browser.py @@ -5753,9 +5753,7 @@ def test_small_js_flags(self): print('size:', size) # Note that this size includes test harness additions (for reporting the result, etc.). if not self.is_wasm64() and not self.is_2gb(): - self.check_expected_size_in_file('js', - test_file('browser/test_small_js_flags.js.size'), - size) + self.check_expected_size_in_file('js', test_file('browser/test_small_js_flags.js.size'), size) # Tests that it is possible to initialize and render WebGL content in a # pthread by using OffscreenCanvas. diff --git a/test/test_other.py b/test/test_other.py index d0d01d35a3f6b..2e3321bb33fa8 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -3321,6 +3321,7 @@ def test_extern_prepost(self): 'emitDCEGraph3': (['emitDCEGraph', '--no-print'],), 'emitDCEGraph4': (['emitDCEGraph', '--no-print'],), 'emitDCEGraph5': (['emitDCEGraph', '--no-print'],), + 'emitDCEGraph-scopes': (['emitDCEGraph', '--no-print'],), 'minimal-runtime-applyDCEGraphRemovals': (['applyDCEGraphRemovals'],), 'applyDCEGraphRemovals': (['applyDCEGraphRemovals'],), 'applyImportAndExportNameChanges': (['applyImportAndExportNameChanges'],), diff --git a/tools/link.py b/tools/link.py index 5cae27464cd90..b495012b620bc 100644 --- a/tools/link.py +++ b/tools/link.py @@ -1504,7 +1504,7 @@ def phase_linker_setup(options, state, newargs): # noqa: C901, PLR0912, PLR0915 if 'MODULARIZE' in user_settings: exit_with_error('EXPORT_ES6 requires MODULARIZE to be set') settings.MODULARIZE = 1 - if shared.target_environment_may_be('node') and not settings.USE_ES6_IMPORT_META: + if settings.ENVIRONMENT_MAY_BE_NODE and not settings.USE_ES6_IMPORT_META: # EXPORT_ES6 + ENVIRONMENT=*node* requires the use of import.meta.url if 'USE_ES6_IMPORT_META' in user_settings: exit_with_error('EXPORT_ES6 and ENVIRONMENT=*node* requires USE_ES6_IMPORT_META to be set') @@ -1850,7 +1850,7 @@ def get_full_import_name(name): if settings.NODE_CODE_CACHING: if settings.WASM_ASYNC_COMPILATION: exit_with_error('NODE_CODE_CACHING requires sync compilation (WASM_ASYNC_COMPILATION=0)') - if not shared.target_environment_may_be('node'): + if not settings.ENVIRONMENT_MAY_BE_NODE: exit_with_error('NODE_CODE_CACHING only works in node, but target environments do not include it') if settings.SINGLE_FILE: exit_with_error('NODE_CODE_CACHING saves a file on the side and is not compatible with SINGLE_FILE') @@ -2458,11 +2458,11 @@ def phase_binaryen(target, options, wasm_target): def node_es6_imports(): - if not settings.EXPORT_ES6 or not shared.target_environment_may_be('node'): + if not settings.EXPORT_ES6 or not settings.ENVIRONMENT_MAY_BE_NODE: return '' # Multi-environment builds uses `await import` in `shell.js` - if shared.target_environment_may_be('web'): + if settings.ENVIRONMENT_MAY_BE_WEB: return '' # Use static import declaration if we only target Node.js @@ -2488,7 +2488,7 @@ def modularize(): # Multi-environment ES6 builds require an async function async_emit = '' - if settings.EXPORT_ES6 and shared.target_environment_may_be('node') and shared.target_environment_may_be('web'): + if settings.EXPORT_ES6 and settings.ENVIRONMENT_MAY_BE_NODE and settings.ENVIRONMENT_MAY_BE_WEB: async_emit = 'async ' # TODO: Remove when https://bugs.webkit.org/show_bug.cgi?id=223533 is resolved. @@ -2536,7 +2536,7 @@ def modularize(): script_url = 'import.meta.url' else: script_url = "typeof document != 'undefined' ? document.currentScript?.src : undefined" - if shared.target_environment_may_be('node'): + if settings.ENVIRONMENT_MAY_BE_NODE: script_url_node = "if (typeof __filename != 'undefined') _scriptName = _scriptName || __filename;" if settings.MODULARIZE == 'instance': src = '''%(node_imports)s