fix corner cases in reduce_vars, side_effects & unused (#5295)
fixes #5294
This commit is contained in:
@@ -2038,6 +2038,32 @@ issue_5015_3: {
|
||||
});
|
||||
console.log("PASS");
|
||||
}
|
||||
expect: {
|
||||
"use strict";
|
||||
(class A {});
|
||||
console.log("PASS");
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=4"
|
||||
}
|
||||
|
||||
issue_5015_4: {
|
||||
options = {
|
||||
reduce_vars: true,
|
||||
sequences: true,
|
||||
side_effects: true,
|
||||
toplevel: true,
|
||||
unused: true,
|
||||
}
|
||||
input: {
|
||||
"use strict";
|
||||
(class A {
|
||||
static f() {
|
||||
return A;
|
||||
}
|
||||
});
|
||||
console.log("PASS");
|
||||
}
|
||||
expect: {
|
||||
"use strict";
|
||||
console.log("PASS");
|
||||
@@ -2336,3 +2362,90 @@ issue_5142: {
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=12"
|
||||
}
|
||||
|
||||
issue_5294_1: {
|
||||
options = {
|
||||
reduce_vars: true,
|
||||
side_effects: true,
|
||||
toplevel: true,
|
||||
}
|
||||
input: {
|
||||
(class A {
|
||||
static p = console.log(typeof A);
|
||||
});
|
||||
}
|
||||
expect: {
|
||||
(class A {
|
||||
static c = console.log(typeof A);
|
||||
});
|
||||
}
|
||||
expect_stdout: "function"
|
||||
node_version: ">=12"
|
||||
}
|
||||
|
||||
issue_5294_2: {
|
||||
options = {
|
||||
reduce_vars: true,
|
||||
side_effects: true,
|
||||
toplevel: true,
|
||||
}
|
||||
input: {
|
||||
class A {
|
||||
static p = console.log(typeof A);
|
||||
}
|
||||
}
|
||||
expect: {
|
||||
class A {
|
||||
static p = console.log(typeof A);
|
||||
}
|
||||
}
|
||||
expect_stdout: "function"
|
||||
node_version: ">=12"
|
||||
}
|
||||
|
||||
issue_5294_3: {
|
||||
options = {
|
||||
reduce_vars: true,
|
||||
toplevel: true,
|
||||
unused: true,
|
||||
}
|
||||
input: {
|
||||
var a = this;
|
||||
(class A {
|
||||
static p = console.log(a === A ? "FAIL" : "PASS");
|
||||
});
|
||||
}
|
||||
expect: {
|
||||
var a = this;
|
||||
(class A {
|
||||
static p = console.log(a === A ? "FAIL" : "PASS");
|
||||
});
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=12"
|
||||
}
|
||||
|
||||
issue_5294_4: {
|
||||
options = {
|
||||
reduce_vars: true,
|
||||
toplevel: true,
|
||||
unused: true,
|
||||
}
|
||||
input: {
|
||||
(class A {
|
||||
static p = function() {
|
||||
var a = this;
|
||||
console.log(a === A ? "FAIL" : "PASS");
|
||||
}();
|
||||
});
|
||||
}
|
||||
expect: {
|
||||
(class A {
|
||||
static p = function() {
|
||||
console.log(this === A ? "FAIL" : "PASS");
|
||||
}();
|
||||
});
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=12"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user