From 7bac3627fe7687469d726c59eab6e49f42e0592c Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 19 Dec 2015 22:47:56 -0500 Subject: [PATCH] Remove await* from babel-generator, add parsing error to babylon - (fixes T6688) --- src/parser/expression.js | 5 ++++- .../fixtures/experimental/await/illegal-await-star/actual.js | 3 +++ .../experimental/await/illegal-await-star/options.json | 4 ++++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 test/fixtures/experimental/await/illegal-await-star/actual.js create mode 100644 test/fixtures/experimental/await/illegal-await-star/options.json diff --git a/src/parser/expression.js b/src/parser/expression.js index 64b7f1c18d..82d0fd7f2e 100644 --- a/src/parser/expression.js +++ b/src/parser/expression.js @@ -968,7 +968,10 @@ pp.parseAwait = function (node) { if (this.isLineTerminator()) { this.unexpected(); } - node.all = this.eat(tt.star); + node.all = false; + 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"); }; diff --git a/test/fixtures/experimental/await/illegal-await-star/actual.js b/test/fixtures/experimental/await/illegal-await-star/actual.js new file mode 100644 index 0000000000..52f31ef5d1 --- /dev/null +++ b/test/fixtures/experimental/await/illegal-await-star/actual.js @@ -0,0 +1,3 @@ +async function bar() { + await* foo(); +} diff --git a/test/fixtures/experimental/await/illegal-await-star/options.json b/test/fixtures/experimental/await/illegal-await-star/options.json new file mode 100644 index 0000000000..85fdea96e9 --- /dev/null +++ b/test/fixtures/experimental/await/illegal-await-star/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["asyncFunctions"], + "throws": "await* has been removed from the async functions proposal. Use Promise.all() instead. (2:2)" +}