Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove await* from babel-generator, add parsing error to babylon - (fixes T6688) #3190

Merged
merged 2 commits into from Dec 23, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/babel-generator/src/generators/expressions.js
Expand Up @@ -118,7 +118,7 @@ function buildYieldAwait(keyword: string) {
return function (node: Object) {
this.push(keyword);

if (node.delegate || node.all) {
if (node.delegate) {
this.push("*");
}

Expand Down
@@ -1,7 +1,3 @@
async function foo() {
await bar();
}

async function bar() {
await* foo();
}
@@ -1,7 +1,3 @@
async function foo() {
await bar();
}

async function bar() {
await* foo();
}
2 changes: 1 addition & 1 deletion packages/babel-plugin-transform-regenerator/src/visit.js
Expand Up @@ -247,7 +247,7 @@ let awaitVisitor = {
},

AwaitExpression: function(path) {
// Convert await and await* expressions to yield expressions.
// Convert await expressions to yield expressions.
let argument = path.node.argument;

// Transforming `await x` to `yield regeneratorRuntime.awrap(x)`
Expand Down
5 changes: 4 additions & 1 deletion packages/babylon/src/parser/expression.js
Expand Up @@ -968,7 +968,10 @@ pp.parseAwait = function (node) {
if (this.isLineTerminator()) {
this.unexpected();
}
node.all = this.eat(tt.star);
node.all = false;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can remove this and then fixup the tests (since otherwise it's node.all being undefined)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I don't see any use for it.

if (this.match(tt.star)) {
this.raise(node.start, "await* has been removed from the async functions proposal. Use Promise.all() instead.")
}
node.argument = this.parseMaybeUnary();
return this.finishNode(node, "AwaitExpression");
};
Expand Down
@@ -0,0 +1,3 @@
async function bar() {
await* foo();
}
@@ -0,0 +1,4 @@
{
"plugins": ["asyncFunctions"],
"throws": "await* has been removed from the async functions proposal. Use Promise.all() instead. (2:2)"
}