[hotfix][T7006] Arrow functions don't have arguments bound

This commit is contained in:
Amjad Masad
2016-01-20 00:41:17 -08:00
parent ec8f0a224e
commit 9980b6b8b2
4 changed files with 39 additions and 23 deletions

View File

@@ -16,8 +16,10 @@ let buildWrapper = template(`
let arrowBuildWrapper = template(`
(() => {
var ref = FUNCTION;
return (PARAMS) => ref.apply(this, arguments);
var ref = FUNCTION, _this = this;
return function(PARAMS) {
return ref.apply(_this, arguments);
};
})
`);

View File

@@ -3,13 +3,17 @@ let TestClass = {
testMethodFailure() {
return new Promise((() => {
var _this = this;
var _this2 = this;
var ref = babelHelpers.asyncToGenerator(function* (resolve) {
console.log(_this);
console.log(_this2);
setTimeout(resolve, 1000);
});
return _x => ref.apply(this, arguments);
}),
_this = this;
return function (_x) {
return ref.apply(_this, arguments);
};
})());
}
};

View File

@@ -1,13 +1,14 @@
async function s(x) {
let t = async (y) => {
let r = async (z) => {
let t = async (y, a) => {
let r = async (z, b) => {
await z;
return this.x;
}
await r;
await r();
return this.g(r);
}
await t;
await t();
return this.h(t);
}

View File

@@ -1,25 +1,34 @@
let s = function () {
var ref = babelHelpers.asyncToGenerator(function* (x) {
let t = (() => {
var _this2 = this;
var _this3 = this;
var ref = babelHelpers.asyncToGenerator(function* (y) {
var ref = babelHelpers.asyncToGenerator(function* (y, a) {
let r = (() => {
var _this = this;
var _this2 = this;
var ref = babelHelpers.asyncToGenerator(function* (z) {
var ref = babelHelpers.asyncToGenerator(function* (z, b) {
yield z;
return _this.x;
});
return _x3 => ref.apply(this, arguments);
})();
yield r;
return _this2.x;
}),
_this = this;
return _this2.g(r);
});
return _x2 => ref.apply(this, arguments);
return function r(_x4, _x5) {
return ref.apply(_this, arguments);
};
})();
yield r();
return _this3.g(r);
}),
_this = this;
return function t(_x2, _x3) {
return ref.apply(_this, arguments);
};
})();
yield t;
yield t();
return this.h(t);
});
return function s(_x) {