Skip to content

Commit 29af243

Browse files
committed
Increase accuracy of isAsyncFunction when followed by a backslash
Issue #1382
1 parent d3f71a6 commit 29af243

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

acorn/src/statement.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ pp.isAsyncFunction = function() {
7070
return !lineBreak.test(this.input.slice(this.pos, next)) &&
7171
this.input.slice(next, next + 8) === "function" &&
7272
(next + 8 === this.input.length ||
73-
!(isIdentifierChar(after = this.input.charCodeAt(next + 8)) || after > 0xd7ff && after < 0xdc00))
73+
!(isIdentifierChar(after = this.input.charCodeAt(next + 8)) || after === 92 || after > 0xd7ff && after < 0xdc00))
7474
}
7575

7676
pp.isUsingKeyword = function(isAwaitUsing, isFor) {

test/tests-asyncawait.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3549,3 +3549,5 @@ test("async () => class { x = await }", {}, {ecmaVersion: 2024})
35493549

35503550
testFail("async () => class { x = await }", "Cannot use keyword 'await' outside an async function (1:24)",
35513551
{ecmaVersion: 2024, sourceType: "module"})
3552+
3553+
testFail("async function\\u1111() { }", "Unexpected token (1:20)", {ecmaVersion: 8})

0 commit comments

Comments
 (0)