fix corner case in collapse_vars (#4946)
This commit is contained in:
@@ -1911,7 +1911,8 @@ merge(Compressor.prototype, {
|
||||
if (!--replaced) abort = true;
|
||||
if (is_lhs(node, multi_replacer.parent())) return node;
|
||||
var ref = rvalue.clone();
|
||||
value_def.references.push(ref);
|
||||
ref.scope = node.scope;
|
||||
ref.reference();
|
||||
if (replaced == assign_pos) {
|
||||
abort = true;
|
||||
return make_node(AST_Assign, candidate, {
|
||||
|
||||
@@ -9245,3 +9245,37 @@ issue_4935: {
|
||||
}
|
||||
expect_stdout: "1 0"
|
||||
}
|
||||
|
||||
inline_throw: {
|
||||
options = {
|
||||
collapse_vars: true,
|
||||
inline: true,
|
||||
keep_fargs: false,
|
||||
unused: true,
|
||||
}
|
||||
input: {
|
||||
try {
|
||||
(function() {
|
||||
return function(a) {
|
||||
return function(b) {
|
||||
throw b;
|
||||
}(a);
|
||||
};
|
||||
})()("PASS");
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
expect: {
|
||||
try {
|
||||
(function(a) {
|
||||
return function() {
|
||||
throw a;
|
||||
}();
|
||||
})("PASS");
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ module.exports = function reduce_test(testcase, minify_options, reduce_options)
|
||||
if (verbose) {
|
||||
log("// Node.js " + process.version + " on " + os.platform() + " " + os.arch());
|
||||
}
|
||||
if (differs.error && [ "DefaultsError", "SyntaxError" ].indexOf(differs.error.name) < 0) {
|
||||
if (differs && differs.error && [ "DefaultsError", "SyntaxError" ].indexOf(differs.error.name) < 0) {
|
||||
test_for_diff = test_minify;
|
||||
differs = test_for_diff(testcase, minify_options, result_cache, max_timeout);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user