fix async function remap helper from outputing incorrect calls causing wrong scoping - fixes #2708 - fixes #2715

This commit is contained in:
Sebastian McKenzie
2015-11-01 04:39:31 +00:00
parent f89724929e
commit 39bdecb119
15 changed files with 124 additions and 49 deletions

View File

@@ -1,5 +1,8 @@
var foo = function () {
return babelHelpers.asyncToGenerator(function* () {
var foo = (function () {
var ref = babelHelpers.asyncToGenerator(function* () {
var wat = yield bar();
})();
};
});
return function foo() {
return ref.apply(this, arguments);
};
})();

View File

@@ -1,5 +1,3 @@
var foo = async function bar() {
console.log(bar);
};
foo();

View File

@@ -1,7 +1,8 @@
var foo = function () {
return babelHelpers.asyncToGenerator(function* bar() {
var foo = (function () {
var ref = babelHelpers.asyncToGenerator(function* bar() {
console.log(bar);
})();
};
foo();
});
return function foo() {
return ref.apply(this, arguments);
};
})();

View File

@@ -0,0 +1,3 @@
foo(async function () {
});

View File

@@ -0,0 +1 @@
foo(babelHelpers.asyncToGenerator(function* () {}));

View File

@@ -0,0 +1,3 @@
async function foo(bar) {
}

View File

@@ -0,0 +1,6 @@
let foo = (function () {
var ref = babelHelpers.asyncToGenerator(function* foo(bar) {});
return function foo(_x) {
return ref.apply(this, arguments);
};
})();

View File

@@ -1,5 +1,8 @@
let foo = function foo() {
return babelHelpers.asyncToGenerator(function* foo() {
let foo = (function () {
var ref = babelHelpers.asyncToGenerator(function* foo() {
var wat = yield bar();
})();
};
});
return function foo() {
return ref.apply(this, arguments);
};
})();

View File

@@ -1,6 +1,10 @@
import { coroutine as _coroutine } from "bluebird";
var foo = function () {
return _coroutine(function* () {
var foo = (function () {
var ref = _coroutine(function* () {
var wat = yield bar();
})();
};
});
return function foo() {
return ref.apply(this, arguments);
};
})();

View File

@@ -1,5 +1,3 @@
var foo = async function bar() {
console.log(bar);
};
foo();

View File

@@ -1,8 +1,10 @@
import { coroutine as _coroutine } from "bluebird";
var foo = function () {
return _coroutine(function* bar() {
var foo = (function () {
var ref = _coroutine(function* bar() {
console.log(bar);
})();
};
});
foo();
return function foo() {
return ref.apply(this, arguments);
};
})();

View File

@@ -1,7 +1,11 @@
import { coroutine as _coroutine } from "bluebird";
let foo = function foo() {
return _coroutine(function* foo() {
let foo = (function () {
var ref = _coroutine(function* foo() {
var wat = yield bar();
})();
};
});
return function foo() {
return ref.apply(this, arguments);
};
})();