@@ -10255,8 +10255,18 @@ Compressor.prototype.compress = function(node) {
|
||||
return all(this.definitions, function(defn) {
|
||||
return !defn.name.match_symbol(function(node) {
|
||||
if (!(node instanceof AST_SymbolDeclaration)) return false;
|
||||
if (node.definition().first_decl !== node) return true;
|
||||
return !safe_from_tdz(compressor, node);
|
||||
var def = node.definition();
|
||||
if (def.first_decl !== node) return true;
|
||||
if (!safe_from_tdz(compressor, node)) return true;
|
||||
var defn_scope = node.scope;
|
||||
if (defn_scope instanceof AST_Scope) return false;
|
||||
return !all(def.references, function(ref) {
|
||||
var scope = ref.scope;
|
||||
do {
|
||||
if (scope === defn_scope) return true;
|
||||
} while (scope = scope.parent_scope);
|
||||
return false;
|
||||
});
|
||||
}, true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2328,3 +2328,66 @@ issue_5741: {
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=4"
|
||||
}
|
||||
|
||||
issue_5745_1: {
|
||||
options = {
|
||||
join_vars: true,
|
||||
reduce_vars: true,
|
||||
toplevel: true,
|
||||
}
|
||||
input: {
|
||||
"use strict";
|
||||
{
|
||||
let f = function() {
|
||||
return f && "PASS";
|
||||
};
|
||||
var a = f();
|
||||
}
|
||||
a;
|
||||
console.log(a);
|
||||
}
|
||||
expect: {
|
||||
"use strict";
|
||||
{
|
||||
let f = function() {
|
||||
return f && "PASS";
|
||||
};
|
||||
var a = f();
|
||||
}
|
||||
a;
|
||||
console.log(a);
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=4"
|
||||
}
|
||||
|
||||
issue_5745_2: {
|
||||
options = {
|
||||
join_vars: true,
|
||||
reduce_vars: true,
|
||||
toplevel: true,
|
||||
}
|
||||
input: {
|
||||
"use strict";
|
||||
{
|
||||
let f = function() {
|
||||
return f && "PASS";
|
||||
};
|
||||
var a = f();
|
||||
a;
|
||||
console.log(a);
|
||||
}
|
||||
}
|
||||
expect: {
|
||||
"use strict";
|
||||
{
|
||||
let f = function() {
|
||||
return f && "PASS";
|
||||
}, a = f();
|
||||
a;
|
||||
console.log(a);
|
||||
}
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=4"
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ function infer_options(options) {
|
||||
exports.default_options = function() {
|
||||
var defs = infer_options({ 0: 0 });
|
||||
Object.keys(defs).forEach(function(component) {
|
||||
var options = {};
|
||||
var options = { module: false };
|
||||
options[component] = { 0: 0 };
|
||||
if (options = infer_options(options)) {
|
||||
defs[component] = options;
|
||||
|
||||
Reference in New Issue
Block a user