fix corner case in collapse_vars (#4797)
This commit is contained in:
@@ -2428,6 +2428,7 @@ merge(Compressor.prototype, {
|
|||||||
if (parent.condition !== node) return node;
|
if (parent.condition !== node) return node;
|
||||||
return find_stop_value(parent, level + 1);
|
return find_stop_value(parent, level + 1);
|
||||||
}
|
}
|
||||||
|
if (parent instanceof AST_Yield) return find_stop_value(parent, level + 1);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -247,6 +247,30 @@ collapse_vars_4: {
|
|||||||
node_version: ">=4"
|
node_version: ">=4"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
collapse_vars_5: {
|
||||||
|
options = {
|
||||||
|
collapse_vars: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
var a = function* f(b, c) {
|
||||||
|
b = yield c = b;
|
||||||
|
console.log(c);
|
||||||
|
}("PASS");
|
||||||
|
a.next();
|
||||||
|
a.next("FAIL");
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
var a = function* f(b, c) {
|
||||||
|
b = yield c = b;
|
||||||
|
console.log(c);
|
||||||
|
}("PASS");
|
||||||
|
a.next();
|
||||||
|
a.next("FAIL");
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
node_version: ">=4"
|
||||||
|
}
|
||||||
|
|
||||||
collapse_property_lambda: {
|
collapse_property_lambda: {
|
||||||
options = {
|
options = {
|
||||||
collapse_vars: true,
|
collapse_vars: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user