swc/crates
CPunisher 8513816139
Some checks are pending
CI / Cargo fmt (push) Waiting to run
CI / Cargo clippy (push) Waiting to run
CI / Check license of dependencies (push) Waiting to run
CI / Check (macos-latest) (push) Waiting to run
CI / Check (ubuntu-latest) (push) Waiting to run
CI / Check (windows-latest) (push) Waiting to run
CI / Test wasm (binding_core_wasm) (push) Waiting to run
CI / Test wasm (binding_minifier_wasm) (push) Waiting to run
CI / Test wasm (binding_typescript_wasm) (push) Waiting to run
CI / List crates (push) Waiting to run
CI / Test - ${{ matrix.settings.crate }} - ${{ matrix.settings.os }} (push) Blocked by required conditions
CI / Test node bindings - ${{ matrix.os }} (macos-latest) (push) Waiting to run
CI / Test node bindings - ${{ matrix.os }} (windows-latest) (push) Waiting to run
CI / Test with @swc/cli (push) Waiting to run
CI / Miri (better_scoped_tls) (push) Waiting to run
CI / Miri (string_enum) (push) Waiting to run
CI / Miri (swc) (push) Waiting to run
CI / Miri (swc_bundler) (push) Waiting to run
CI / Miri (swc_ecma_codegen) (push) Waiting to run
CI / Miri (swc_ecma_minifier) (push) Waiting to run
CI / Done (push) Blocked by required conditions
Benchmark / Bench everything (push) Waiting to run
fix(es/minifier): Prevent removing side effects from accessing getter (#9530)
Closes https://github.com/swc-project/swc/issues/9500

Caused by
c7fdd6b69b/crates/swc_ecma_minifier/src/compress/pure/misc.rs (L1547).
When the object with getters pass to `self.ignore_return_value`,

c7fdd6b69b/crates/swc_ecma_minifier/src/compress/pure/misc.rs (L966)
converts the object to `0` because the object is side-effect-free
according to

c7fdd6b69b/crates/swc_ecma_utils/src/lib.rs (L1496)

We should skip this process to fix the issue.

As is known only accessing getters and setters may cause side effect, we
can safely do the transformation when none of them appears in the
object. More precision is possible if comparing the lit prop names. I
also collect computed keys of getters and setters in the object, is
there any bad case?

The reason why only numeric (string) key removes the statement is that
string key (`Computed`) is converted to `Ident` in other phases, e.g.
`{}['a']` => `{}.a`, which does not matching the pattern.
2024-09-04 12:28:46 +00:00
..
ast_node chore: Bump crates 2024-07-19 04:27:57 +00:00
better_scoped_tls chore: Apply cargo autoinherit (#8902) 2024-04-29 00:54:45 +00:00
binding_macros chore: Publish crates with swc_core v0.103.0 2024-09-03 06:05:40 +09:00
dbg-swc chore: Publish crates with swc_core v0.103.0 2024-09-03 06:05:40 +09:00
from_variant chore: Bump crates 2024-07-19 04:27:57 +00:00
jsdoc chore: Bump crates 2024-08-05 18:14:11 +09:00
preset_env_base chore: Bump preset_env_base 2024-07-06 09:33:36 +09:00
string_enum chore: Bump crates 2024-04-29 09:56:27 +09:00
swc fix(es/typescript): Handle enum in single statement (#9532) 2024-09-04 20:56:11 +09:00
swc_allocator chore: Publish crates 2024-07-21 21:22:19 +09:00
swc_atoms feat(allocator): Add a cargo feature (#9239) 2024-07-15 15:22:26 +09:00
swc_bundler chore: Publish crates with swc_core v0.103.0 2024-09-03 06:05:40 +09:00
swc_cached chore: Apply cargo autoinherit (#8902) 2024-04-29 00:54:45 +00:00
swc_cli_impl chore: Publish crates with swc_core v0.103.0 2024-09-03 06:05:40 +09:00
swc_common chore: Publish crates with swc_core v0.101.5 2024-08-23 11:33:28 +09:00
swc_compiler_base chore: Publish crates with swc_core v0.103.0 2024-09-03 06:05:40 +09:00
swc_config chore: Bump crates 2024-06-07 07:18:53 +00:00
swc_config_macro chore: Bump crates 2024-04-29 09:56:27 +09:00
swc_core chore: Publish crates with swc_core v0.103.1 2024-09-03 06:21:01 +09:00
swc_css chore: Bump crates 2024-08-05 18:14:11 +09:00
swc_css_ast chore: Bump crates 2024-08-05 18:14:11 +09:00
swc_css_codegen chore: Bump crates 2024-08-05 18:14:11 +09:00
swc_css_codegen_macros chore: Bump crates 2024-04-29 09:56:27 +09:00
swc_css_compat chore: Bump crates 2024-08-05 18:14:11 +09:00
swc_css_lints chore: Bump crates 2024-08-05 18:14:11 +09:00
swc_css_minifier chore: Bump crates 2024-08-05 18:14:11 +09:00
swc_css_modules chore: Bump crates 2024-08-05 18:14:11 +09:00
swc_css_parser chore: Bump crates 2024-08-05 18:14:11 +09:00
swc_css_prefixer chore: Bump crates 2024-08-05 18:14:11 +09:00
swc_css_utils chore: Bump crates 2024-08-05 18:14:11 +09:00
swc_css_visit chore: Publish crates with swc_core v0.101.5 2024-08-23 11:33:28 +09:00
swc_ecma_ast chore: Publish crates with swc_core v0.101.3 2024-08-19 09:56:39 +00:00
swc_ecma_codegen chore: Publish crates with swc_core v0.101.7 2024-08-26 07:57:00 +09:00
swc_ecma_codegen_macros chore: Publish crates 2024-07-23 18:48:57 +09:00
swc_ecma_compat_bugfixes chore: Publish crates with swc_core v0.103.0 2024-09-03 06:05:40 +09:00
swc_ecma_compat_common chore: Bump crates 2024-08-05 18:14:11 +09:00
swc_ecma_compat_es3 chore: Publish crates with swc_core v0.103.0 2024-09-03 06:05:40 +09:00
swc_ecma_compat_es2015 chore: Publish crates with swc_core v0.103.0 2024-09-03 06:05:40 +09:00
swc_ecma_compat_es2016 chore: Publish crates with swc_core v0.103.0 2024-09-03 06:05:40 +09:00
swc_ecma_compat_es2017 chore: Publish crates with swc_core v0.103.0 2024-09-03 06:05:40 +09:00
swc_ecma_compat_es2018 chore: Publish crates with swc_core v0.103.0 2024-09-03 06:05:40 +09:00
swc_ecma_compat_es2019 chore: Publish crates with swc_core v0.103.0 2024-09-03 06:05:40 +09:00
swc_ecma_compat_es2020 chore: Publish crates with swc_core v0.103.0 2024-09-03 06:05:40 +09:00
swc_ecma_compat_es2021 chore: Publish crates with swc_core v0.103.0 2024-09-03 06:05:40 +09:00
swc_ecma_compat_es2022 chore: Publish crates with swc_core v0.103.0 2024-09-03 06:05:40 +09:00
swc_ecma_ext_transforms chore: Bump crates 2024-08-05 18:14:11 +09:00
swc_ecma_lints chore: Publish crates with swc_core v0.103.0 2024-09-03 06:05:40 +09:00
swc_ecma_loader chore: Publish crates 2024-08-06 00:18:31 +00:00
swc_ecma_minifier fix(es/minifier): Prevent removing side effects from accessing getter (#9530) 2024-09-04 12:28:46 +00:00
swc_ecma_parser chore: Publish crates with swc_core v0.101.5 2024-08-23 11:33:28 +09:00
swc_ecma_preset_env chore: Publish crates with swc_core v0.103.0 2024-09-03 06:05:40 +09:00
swc_ecma_quote chore: Bump crates 2024-08-05 18:14:11 +09:00
swc_ecma_quote_macros chore: Bump crates 2024-08-05 18:14:11 +09:00
swc_ecma_testing chore: Bump crates 2024-08-05 18:14:11 +09:00
swc_ecma_transforms chore: Publish crates with swc_core v0.103.0 2024-09-03 06:05:40 +09:00
swc_ecma_transforms_base chore: Publish crates with swc_core v0.103.0 2024-09-03 06:05:40 +09:00
swc_ecma_transforms_classes chore: Publish crates with swc_core v0.103.0 2024-09-03 06:05:40 +09:00
swc_ecma_transforms_compat chore: Publish crates with swc_core v0.103.0 2024-09-03 06:05:40 +09:00
swc_ecma_transforms_macros chore: Bump crates 2024-04-29 09:56:27 +09:00
swc_ecma_transforms_module chore: Publish crates with swc_core v0.103.0 2024-09-03 06:05:40 +09:00
swc_ecma_transforms_optimization chore: Publish crates with swc_core v0.103.0 2024-09-03 06:05:40 +09:00
swc_ecma_transforms_proposal chore: Publish crates with swc_core v0.103.0 2024-09-03 06:05:40 +09:00
swc_ecma_transforms_react chore: Publish crates with swc_core v0.103.0 2024-09-03 06:05:40 +09:00
swc_ecma_transforms_testing chore: Publish crates with swc_core v0.103.0 2024-09-03 06:05:40 +09:00
swc_ecma_transforms_typescript fix(es/typescript): Handle enum in single statement (#9532) 2024-09-04 20:56:11 +09:00
swc_ecma_usage_analyzer chore: Publish crates with swc_core v0.102.1 2024-08-28 05:13:16 +00:00
swc_ecma_utils chore: Publish crates with swc_core v0.103.0 2024-09-03 06:08:14 +09:00
swc_ecma_visit chore: Publish crates with swc_core v0.101.5 2024-08-23 11:33:28 +09:00
swc_ecmascript chore: Publish crates with swc_core v0.103.0 2024-09-03 06:05:40 +09:00
swc_eq_ignore_macros chore: Bump crates 2024-07-19 04:27:57 +00:00
swc_error_reporters chore: Bump crates 2024-08-05 18:14:11 +09:00
swc_estree_ast chore: Bump crates 2024-08-05 18:14:11 +09:00
swc_estree_compat chore: Publish crates with swc_core v0.103.0 2024-09-03 06:05:40 +09:00
swc_fast_graph chore: Bump crates 2024-08-05 18:14:11 +09:00
swc_fast_ts_strip chore: Publish crates with swc_core v0.103.0 2024-09-03 06:05:40 +09:00
swc_graph_analyzer chore: Bump crates 2024-08-05 18:14:11 +09:00
swc_html chore: Publish crates with swc_core v0.103.0 2024-09-03 06:05:40 +09:00
swc_html_ast chore: Bump crates 2024-08-05 18:14:11 +09:00
swc_html_codegen chore: Bump crates 2024-08-05 18:14:11 +09:00
swc_html_codegen_macros refactor(visit): Pre-generate visitor code (#9262) 2024-07-17 23:00:45 +00:00
swc_html_minifier chore: Publish crates with swc_core v0.103.0 2024-09-03 06:05:40 +09:00
swc_html_parser chore: Bump crates 2024-08-05 18:14:11 +09:00
swc_html_utils chore: Bump crates 2024-08-05 18:14:11 +09:00
swc_html_visit chore: Publish crates with swc_core v0.101.5 2024-08-23 11:33:28 +09:00
swc_macros_common chore: Publish crates 2024-07-23 18:48:57 +09:00
swc_malloc chore: Bump crates 2024-07-07 00:36:16 +00:00
swc_node_bundler chore: Publish crates with swc_core v0.103.0 2024-09-03 06:05:40 +09:00
swc_node_comments chore: Bump crates 2024-08-05 18:14:11 +09:00
swc_nodejs_common chore: Apply cargo autoinherit (#8902) 2024-04-29 00:54:45 +00:00
swc_plugin chore: Bump crates 2024-07-19 04:27:57 +00:00
swc_plugin_macro chore: Apply cargo autoinherit (#8902) 2024-04-29 00:54:45 +00:00
swc_plugin_proxy chore: Bump crates 2024-08-05 18:14:11 +09:00
swc_plugin_runner chore: Publish crates with swc_core v0.102.1 2024-08-28 05:13:16 +00:00
swc_plugin_testing refactor(visit): Pre-generate visitor code (#9262) 2024-07-17 23:00:45 +00:00
swc_timer chore: Bump crates 2024-08-05 18:14:11 +09:00
swc_trace_macro chore: Apply cargo autoinherit (#8902) 2024-04-29 00:54:45 +00:00
swc_transform_common feat(es): Integrate experimental data API (#9027) 2024-06-07 21:00:26 +09:00
swc_typescript chore: Bump crates 2024-08-05 18:14:11 +09:00
swc_visit chore: Publish crates 2024-08-12 14:48:20 +09:00
swc_x_optimizer feat(x): Initialize project (#8999) 2024-05-31 00:56:21 +00:00
swc_xml chore: Bump crates 2024-08-05 18:14:11 +09:00
swc_xml_ast chore: Bump crates 2024-08-05 18:14:11 +09:00
swc_xml_codegen chore: Bump crates 2024-08-05 18:14:11 +09:00
swc_xml_codegen_macros refactor(visit): Pre-generate visitor code (#9262) 2024-07-17 23:00:45 +00:00
swc_xml_parser chore: Bump crates 2024-08-05 18:14:11 +09:00
swc_xml_visit chore: Publish crates with swc_core v0.101.5 2024-08-23 11:33:28 +09:00
testing chore: Bump crates 2024-08-05 18:14:11 +09:00
testing_macros chore: Bump crates 2024-07-19 04:27:57 +00:00