handle AST_SymbolFunarg
This commit is contained in:
parent
68d3a1718d
commit
8334f86f30
|
|
@ -4217,7 +4217,8 @@ merge(Compressor.prototype, {
|
|||
if (fixed && d.should_replace === undefined) {
|
||||
var init;
|
||||
if (fixed instanceof AST_This) {
|
||||
if (all(d.references, function(ref) {
|
||||
if (!(d.orig[0] instanceof AST_SymbolFunarg)
|
||||
&& all(d.references, function(ref) {
|
||||
return d.scope === ref.scope;
|
||||
})) {
|
||||
init = fixed;
|
||||
|
|
|
|||
|
|
@ -3296,7 +3296,7 @@ escaped_prop: {
|
|||
expect_stdout: "2"
|
||||
}
|
||||
|
||||
issue_2420: {
|
||||
issue_2420_1: {
|
||||
options = {
|
||||
reduce_vars: true,
|
||||
unused: true,
|
||||
|
|
@ -3337,3 +3337,49 @@ issue_2420: {
|
|||
"foo",
|
||||
]
|
||||
}
|
||||
|
||||
issue_2420_2: {
|
||||
options = {
|
||||
reduce_vars: true,
|
||||
unused: true,
|
||||
}
|
||||
input: {
|
||||
function f() {
|
||||
var t = this;
|
||||
if (t.bar)
|
||||
t.foo();
|
||||
else
|
||||
!function(t) {
|
||||
console.log(this === t);
|
||||
}(this);
|
||||
}
|
||||
var o = {
|
||||
bar: 1,
|
||||
foo: function() { console.log("foo", this.bar); },
|
||||
};
|
||||
f.call(o);
|
||||
o.bar = 0;
|
||||
f.call(o);
|
||||
}
|
||||
expect: {
|
||||
function f() {
|
||||
if (this.bar)
|
||||
this.foo();
|
||||
else
|
||||
!function(t) {
|
||||
console.log(this === t);
|
||||
}(this);
|
||||
}
|
||||
var o = {
|
||||
bar: 1,
|
||||
foo: function() { console.log("foo", this.bar); },
|
||||
};
|
||||
f.call(o);
|
||||
o.bar = 0;
|
||||
f.call(o);
|
||||
}
|
||||
expect_stdout: [
|
||||
"foo 1",
|
||||
"false",
|
||||
]
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user