add in support for AwaitExpression "delegation"

This commit is contained in:
Sebastian McKenzie
2015-01-29 15:11:17 +11:00
parent e469c864bc
commit 03942da57a
2 changed files with 11 additions and 1 deletions

View File

@@ -87,7 +87,11 @@ exports.CallExpression = function (node, print) {
var buildYieldAwait = function (keyword) {
return function (node, print) {
this.push(keyword);
if (node.delegate) this.push("*");
if (node.delegate || node.all) {
this.push("*");
}
if (node.argument) {
this.space();
print(node.argument);

View File

@@ -9,6 +9,12 @@ var visitor = {
if (t.isAwaitExpression(node)) {
node.type = "YieldExpression";
if (node.all) {
// await* foo; -> yield Promise.all(foo);
node.all = false;
node.argument = t.callExpression(t.memberExpression(t.identifier("Promise"), t.identifier("all")), [node.argument]);
}
}
}
};