enhance varify (#4303)
This commit is contained in:
@@ -7124,7 +7124,9 @@ merge(Compressor.prototype, {
|
||||
var def = name.definition();
|
||||
def.orig[def.orig.indexOf(node)] = name;
|
||||
var scope = def.scope.resolve();
|
||||
if (def.scope !== scope) scope.variables.set(def.name, def);
|
||||
if (def.scope === scope) return;
|
||||
def.scope = scope;
|
||||
scope.variables.set(def.name, def);
|
||||
}),
|
||||
value: defn.value
|
||||
});
|
||||
|
||||
@@ -390,3 +390,22 @@ issue_4290_1_let: {
|
||||
expect_stdout: true
|
||||
node_version: ">=4"
|
||||
}
|
||||
|
||||
drop_forin_let: {
|
||||
options = {
|
||||
loops: true,
|
||||
toplevel: true,
|
||||
unused: true,
|
||||
varify: true,
|
||||
}
|
||||
input: {
|
||||
"use strict";
|
||||
for (let a in console.log("PASS"));
|
||||
}
|
||||
expect: {
|
||||
"use strict";
|
||||
console.log("PASS");
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=4"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user