fix reduce_vars on catch variable
Improved catch handling in `figure_out_scope()` means special case treatment of IE8 is no longer valid in `reset_opt_flags()`.
This commit is contained in:
parent
cc6aa3e5ac
commit
3f09efeeea
|
|
@ -251,7 +251,6 @@ merge(Compressor.prototype, {
|
||||||
AST_Node.DEFMETHOD("reset_opt_flags", function(compressor, rescan){
|
AST_Node.DEFMETHOD("reset_opt_flags", function(compressor, rescan){
|
||||||
var reduce_vars = rescan && compressor.option("reduce_vars");
|
var reduce_vars = rescan && compressor.option("reduce_vars");
|
||||||
var toplevel = compressor.option("toplevel");
|
var toplevel = compressor.option("toplevel");
|
||||||
var ie8 = !compressor.option("screw_ie8");
|
|
||||||
var safe_ids = [];
|
var safe_ids = [];
|
||||||
push();
|
push();
|
||||||
var suppressor = new TreeWalker(function(node) {
|
var suppressor = new TreeWalker(function(node) {
|
||||||
|
|
@ -277,7 +276,7 @@ merge(Compressor.prototype, {
|
||||||
d.fixed = false;
|
d.fixed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ie8 && node instanceof AST_SymbolCatch) {
|
if (node instanceof AST_SymbolCatch) {
|
||||||
node.definition().fixed = false;
|
node.definition().fixed = false;
|
||||||
}
|
}
|
||||||
if (node instanceof AST_VarDef) {
|
if (node instanceof AST_VarDef) {
|
||||||
|
|
|
||||||
|
|
@ -1938,3 +1938,28 @@ pure_getters: {
|
||||||
}
|
}
|
||||||
expect_stdout: "undefined"
|
expect_stdout: "undefined"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
catch_var: {
|
||||||
|
options = {
|
||||||
|
booleans: true,
|
||||||
|
evaluate: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
try {
|
||||||
|
throw {};
|
||||||
|
} catch (e) {
|
||||||
|
var e;
|
||||||
|
console.log(!!e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
try {
|
||||||
|
throw {};
|
||||||
|
} catch (e) {
|
||||||
|
var e;
|
||||||
|
console.log(!!e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
expect_stdout: "true"
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user