Fix for deeply nested async arrows

This commit is contained in:
horpto 2016-01-11 04:37:16 +05:00
parent f2fdc74d1b
commit fa9f8ea4be
3 changed files with 44 additions and 1 deletions

View File

@ -27,7 +27,9 @@ let awaitVisitor = {
}, },
ArrowFunctionExpression(path) { ArrowFunctionExpression(path) {
if (!path.node.async) {
path.arrowFunctionToShadowed(); path.arrowFunctionToShadowed();
}
}, },
AwaitExpression({ node }) { AwaitExpression({ node }) {

View File

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

View File

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