@@ -4931,7 +4931,11 @@ merge(Compressor.prototype, {
|
|||||||
if (def.single_use) return;
|
if (def.single_use) return;
|
||||||
if (top_retain(def)) return;
|
if (top_retain(def)) return;
|
||||||
if (sym.fixed_value() !== right) return;
|
if (sym.fixed_value() !== right) return;
|
||||||
return right instanceof AST_Object && right.properties.length > 0;
|
return right instanceof AST_Object
|
||||||
|
&& right.properties.length > 0
|
||||||
|
&& all(right.properties, function(prop) {
|
||||||
|
return prop instanceof AST_ObjectKeyVal;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ var file = process.argv[2];
|
|||||||
var dir = path.resolve(path.dirname(module.filename), "compress");
|
var dir = path.resolve(path.dirname(module.filename), "compress");
|
||||||
if (file) {
|
if (file) {
|
||||||
var minify_options = require("./ufuzz/options.json").map(JSON.stringify);
|
var minify_options = require("./ufuzz/options.json").map(JSON.stringify);
|
||||||
U.AST_Node.enable_validation();
|
|
||||||
log("--- {file}", { file: file });
|
log("--- {file}", { file: file });
|
||||||
var tests = parse_test(path.resolve(dir, file));
|
var tests = parse_test(path.resolve(dir, file));
|
||||||
process.exit(Object.keys(tests).filter(function(name) {
|
process.exit(Object.keys(tests).filter(function(name) {
|
||||||
@@ -189,6 +188,7 @@ function reminify(orig_options, input_code, input_formatted, stdout) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
var options_formatted = JSON.stringify(options, null, 4);
|
var options_formatted = JSON.stringify(options, null, 4);
|
||||||
|
options.validate = true;
|
||||||
var result = U.minify(input_code, options);
|
var result = U.minify(input_code, options);
|
||||||
if (result.error) {
|
if (result.error) {
|
||||||
log([
|
log([
|
||||||
@@ -252,6 +252,7 @@ function run_code(code, toplevel) {
|
|||||||
|
|
||||||
function test_case(test) {
|
function test_case(test) {
|
||||||
log(" Running test [{name}]", { name: test.name });
|
log(" Running test [{name}]", { name: test.name });
|
||||||
|
U.AST_Node.enable_validation();
|
||||||
var output_options = test.beautify || {};
|
var output_options = test.beautify || {};
|
||||||
var expect;
|
var expect;
|
||||||
if (test.expect) {
|
if (test.expect) {
|
||||||
|
|||||||
@@ -940,3 +940,35 @@ issue_3868: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_3871: {
|
||||||
|
options = {
|
||||||
|
hoist_props: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
console.log(function() {
|
||||||
|
do {
|
||||||
|
var b = {
|
||||||
|
get null() {
|
||||||
|
c;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} while (!b);
|
||||||
|
return "PASS";
|
||||||
|
}());
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
console.log(function() {
|
||||||
|
do {
|
||||||
|
var b = {
|
||||||
|
get null() {
|
||||||
|
c;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} while (!b);
|
||||||
|
return "PASS";
|
||||||
|
}());
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user