From 75be1790544fc73efea741eb2ac493109428706e Mon Sep 17 00:00:00 2001 From: alexlamsl Date: Fri, 3 Nov 2017 19:30:17 +0800 Subject: [PATCH] improve test --- test/compress/reduce_vars.js | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js index 5ec5bfde..e4d22e9b 100644 --- a/test/compress/reduce_vars.js +++ b/test/compress/reduce_vars.js @@ -3345,41 +3345,37 @@ issue_2420_2: { } input: { function f() { - var t = this; - if (t.bar) - t.foo(); + var that = this; + if (that.bar) + that.foo(); else - !function(t) { - console.log(this === t); - }(this); + !function(that, self) { + console.log(this === that, self === this, that === self); + }(that, this); } - var o = { + f.call({ bar: 1, foo: function() { console.log("foo", this.bar); }, - }; - f.call(o); - o.bar = 0; - f.call(o); + }); + f.call({}); } expect: { function f() { if (this.bar) this.foo(); else - !function(t) { - console.log(this === t); - }(this); + !function(that, self) { + console.log(this === that, self === this, that === self); + }(this, this); } - var o = { + f.call({ bar: 1, foo: function() { console.log("foo", this.bar); }, - }; - f.call(o); - o.bar = 0; - f.call(o); + }); + f.call({}); } expect_stdout: [ "foo 1", - "false", + "false false true", ] }