From 848d14e20653a211b06c8e167810bd4fae2173cf Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Mon, 5 Oct 2020 08:04:58 +0200 Subject: [PATCH] Make await x ** y fail to parse Closes #984 --- acorn/src/expression.js | 2 +- test/tests-asyncawait.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/acorn/src/expression.js b/acorn/src/expression.js index cf7c05c87..f1e4f5811 100644 --- a/acorn/src/expression.js +++ b/acorn/src/expression.js @@ -1029,6 +1029,6 @@ pp.parseAwait = function() { let node = this.startNode() this.next() - node.argument = this.parseMaybeUnary(null, false) + node.argument = this.parseMaybeUnary(null, true) return this.finishNode(node, "AwaitExpression") } diff --git a/test/tests-asyncawait.js b/test/tests-asyncawait.js index f5d84794b..e5ed2e7c5 100644 --- a/test/tests-asyncawait.js +++ b/test/tests-asyncawait.js @@ -3524,6 +3524,6 @@ test("({ async delete() {} })", {}, {ecmaVersion: 8}) testFail("abc: async function a() {}", "Unexpected token (1:5)", {ecmaVersion: 8}) -test("(async() => { await 4 ** 2 })()", {}, {ecmaVersion: 8}) +testFail("(async() => { await 4 ** 2 })()", "Unexpected token (1:22)", {ecmaVersion: 8}) testFail("4 + async() => 2", "Unexpected token (1:12)", {ecmaVersion: 8, loose: false})