Skip to content

Commit 3122e94

Browse files
authoredFeb 7, 2024
feat(es/minifier): Implement correct hoist_props (#8593)
**Description:** - The option `hoist_props` now does what it's supposed to do. - Dropping of unused properties now does not drop properties too aggressively. - The initializer of a dropped variable declaration is now properly visited. - Indexing with string literals is not marked as a dynamic index anymore. This is required to handle codes like https://github.com/swc-project/swc/blob/c3f67ceb1eb0cab9ef4a47c321acf90684bf216a/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/name_collision_1/input.js#L1-L7.
1 parent be55633 commit 3122e94

File tree

59 files changed

+1162
-1250
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1162
-1250
lines changed
 

‎crates/swc/tests/tsc-references/callSignaturesWithOptionalParameters.2.minified.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,5 @@
22
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
33
var c, i, a, f = function(x) {}, f2 = function(x, y) {};
44
f(1), f(), f2(1), f2(1, 2), c.foo(), c.foo(1), i(), i(1), i.foo(1), i.foo(1, 2), a(), a(1), a.foo(), a.foo(1);
5-
var b = {
6-
foo: function(x) {},
7-
a: function(x, y) {},
8-
b: function(x) {}
9-
};
10-
b.foo(), b.foo(1), b.a(1), b.a(1, 2), b.b(), b.b(1);
5+
var b_foo = function(x) {}, b_a = function(x, y) {}, b_b = function(x) {};
6+
b_foo(), b_foo(1), b_a(1), b_a(1, 2), b_b(), b_b(1);

‎crates/swc/tests/tsc-references/checkJsdocSatisfiesTag10.2.minified.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//// [/a.js]
33
var p = {
44
a: 0,
5-
b: "hello"
5+
b: "hello",
6+
x: 8
67
};
78
p.a.toFixed(), p.b.substring(1), p.d;

0 commit comments

Comments
 (0)
Please sign in to comment.