fix corner case in unsafe_proto

This commit is contained in:
alexlamsl 2018-01-17 16:30:44 +08:00
parent 3b679cd5d2
commit 3caf6062d5
2 changed files with 28 additions and 4 deletions

View File

@ -310,9 +310,9 @@ var AST_Scope = DEFNODE("Scope", "variables functions uses_with uses_eval parent
},
clone: function(deep) {
var node = this._clone(deep);
node.variables = this.variables.clone();
node.functions = this.functions.clone();
node.enclosed = this.enclosed.slice();
if (this.variables) node.variables = this.variables.clone();
if (this.functions) node.functions = this.functions.clone();
if (this.enclosed) node.enclosed = this.enclosed.slice();
return node;
}
}, AST_Block);

View File

@ -5303,7 +5303,7 @@ issue_2774: {
expect_stdout: "undefined"
}
issue_2799: {
issue_2799_1: {
options = {
reduce_funcs: true,
reduce_vars: true,
@ -5336,3 +5336,27 @@ issue_2799: {
}
expect_stdout: "15"
}
issue_2799_2: {
options = {
reduce_vars: true,
unsafe_proto: true,
unused: true,
}
input: {
(function() {
function foo() {
Function.prototype.call.apply(console.log, [ null, "PASS" ]);
}
foo();
})();
}
expect: {
(function() {
(function() {
(function() {}).call.apply(console.log, [ null, "PASS" ]);
})();
})();
}
expect_stdout: "PASS"
}