Skip to content

Commit

Permalink
Make await x ** y fail to parse
Browse files Browse the repository at this point in the history
Closes #984
  • Loading branch information
marijnh committed Oct 5, 2020
1 parent de974c4 commit 848d14e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion acorn/src/expression.js
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
2 changes: 1 addition & 1 deletion test/tests-asyncawait.js
Original file line number Diff line number Diff line change
Expand Up @@ -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})

0 comments on commit 848d14e

Please sign in to comment.