Skip to content

Commit 5ffc17d

Browse files
committed
fix corner case in unused
1 parent 6aa7500 commit 5ffc17d

Some content is hidden

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

56 files changed

+1573
-958
lines changed

lib/ast.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ var AST_Toplevel = DEFNODE("Toplevel", "globals", {
328328
var body = this.body;
329329
var wrapped_tl = "(function(exports){'$ORIG';})(typeof " + name + "=='undefined'?(" + name + "={}):" + name + ");";
330330
wrapped_tl = parse(wrapped_tl);
331-
wrapped_tl = wrapped_tl.transform(new TreeTransformer(function before(node) {
331+
wrapped_tl = wrapped_tl.transform(new TreeTransformer(function(node) {
332332
if (node instanceof AST_Directive && node.value == "$ORIG") {
333333
return MAP.splice(body);
334334
}

lib/compress.js

+175-176
Large diffs are not rendered by default.

test/compress/arrays.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ holes_and_undefined: {
1515

1616
constant_join: {
1717
options = {
18-
unsafe : true,
19-
evaluate : true
20-
};
18+
evaluate: true,
19+
unsafe: true,
20+
}
2121
input: {
2222
var a = [ "foo", "bar", "baz" ].join("");
2323
var a1 = [ "foo", "bar", "baz" ].join();
@@ -64,9 +64,9 @@ constant_join: {
6464

6565
constant_join_2: {
6666
options = {
67-
unsafe : true,
68-
evaluate : true
69-
};
67+
evaluate: true,
68+
unsafe: true,
69+
}
7070
input: {
7171
var a = [ "foo", "bar", boo(), "baz", "x", "y" ].join("");
7272
var b = [ "foo", "bar", boo(), "baz", "x", "y" ].join("-");
@@ -93,9 +93,9 @@ constant_join_2: {
9393

9494
constant_join_3: {
9595
options = {
96-
unsafe: true,
9796
evaluate: true,
98-
};
97+
unsafe: true,
98+
}
9999
input: {
100100
var a = [ null ].join();
101101
var b = [ , ].join();
@@ -133,7 +133,7 @@ for_loop: {
133133
reduce_vars: true,
134134
unsafe: true,
135135
unused: true,
136-
};
136+
}
137137
input: {
138138
function f0() {
139139
var a = [1, 2, 3];

test/compress/asm.js

+19-19
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
asm_mixed: {
22
options = {
3-
sequences : true,
4-
properties : true,
5-
dead_code : true,
6-
drop_debugger : true,
7-
conditionals : true,
8-
comparisons : true,
9-
evaluate : true,
10-
booleans : true,
11-
loops : true,
12-
unused : true,
13-
hoist_funs : true,
14-
keep_fargs : true,
15-
keep_fnames : false,
16-
hoist_vars : true,
17-
if_return : true,
18-
join_vars : true,
19-
side_effects : true,
20-
negate_iife : true
21-
};
3+
booleans: true,
4+
comparisons: true,
5+
conditionals: true,
6+
dead_code: true,
7+
drop_debugger: true,
8+
evaluate: true,
9+
hoist_funs: true,
10+
hoist_vars: true,
11+
if_return: true,
12+
join_vars: true,
13+
keep_fargs: true,
14+
keep_fnames: false,
15+
loops: true,
16+
negate_iife: true,
17+
properties: true,
18+
sequences: true,
19+
side_effects: true,
20+
unused: true,
21+
}
2222
input: {
2323
// adapted from http://asmjs.org/spec/latest/
2424
function asm_GeometricMean(stdlib, foreign, buffer) {

0 commit comments

Comments
 (0)