fix corner case in reduce_vars (#4636)
This commit is contained in:
@@ -9836,7 +9836,8 @@ merge(Compressor.prototype, {
|
|||||||
}
|
}
|
||||||
} while (scope = scope.parent_scope);
|
} while (scope = scope.parent_scope);
|
||||||
}
|
}
|
||||||
} else if (fixed.name && fixed.name.name == "await" && is_async(fixed)) {
|
} else if (fixed.name && (fixed.name.name == "await" && is_async(fixed)
|
||||||
|
|| fixed.name.name == "yield" && is_generator(fixed))) {
|
||||||
single_use = false;
|
single_use = false;
|
||||||
}
|
}
|
||||||
if (single_use) fixed.parent_scope = self.scope;
|
if (single_use) fixed.parent_scope = self.scope;
|
||||||
|
|||||||
@@ -255,6 +255,71 @@ collapse_property_lambda: {
|
|||||||
node_version: ">=4"
|
node_version: ">=4"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defun_name: {
|
||||||
|
input: {
|
||||||
|
function* yield() {
|
||||||
|
console.log("PASS");
|
||||||
|
}
|
||||||
|
yield().next();
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
function* yield() {
|
||||||
|
console.log("PASS");
|
||||||
|
}
|
||||||
|
yield().next();
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
node_version: ">=4"
|
||||||
|
}
|
||||||
|
|
||||||
|
drop_fname: {
|
||||||
|
rename = true
|
||||||
|
options = {
|
||||||
|
reduce_vars: true,
|
||||||
|
toplevel: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
mangle = {
|
||||||
|
toplevel: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
function* yield() {
|
||||||
|
console.log("PASS");
|
||||||
|
}
|
||||||
|
yield().next();
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
(function*() {
|
||||||
|
console.log("PASS");
|
||||||
|
})().next();
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
node_version: ">=4"
|
||||||
|
}
|
||||||
|
|
||||||
|
keep_fname: {
|
||||||
|
options = {
|
||||||
|
keep_fnames: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
toplevel: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
function* yield() {
|
||||||
|
console.log("PASS");
|
||||||
|
}
|
||||||
|
yield().next();
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
function* yield() {
|
||||||
|
console.log("PASS");
|
||||||
|
}
|
||||||
|
yield().next();
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
node_version: ">=4"
|
||||||
|
}
|
||||||
|
|
||||||
evaluate: {
|
evaluate: {
|
||||||
options = {
|
options = {
|
||||||
evaluate: true,
|
evaluate: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user