Skip to content

Commit df3491f

Browse files
authored
- bugfix - fix expression after "await" mis-identified as statement (#405)
1 parent 878a573 commit df3491f

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
- node - after node-v14 is deprecated, remove shell-code `export "NODE_OPTIONS=--unhandled-rejections=strict"`.
1616

1717
# v2022.6.1-beta
18+
- bugfix - fix expression after "await" mis-identified as statement
1819
- directive - add new directive `subscript` for linting of scripts targeting Google Closure Compiler
1920
- warning - relax warning about missing `catch` in `try...finally` statement
2021
- jslint - allow aliases `evil, nomen` for jslint-directives `eval, name`, respectively for backwards-compat

jslint.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5293,10 +5293,13 @@ function jslint_phase3_parse(state) {
52935293
functionage.async += 1;
52945294
}
52955295
if (the_await.arity === "statement") {
5296-
the_await.block = parse_expression();
5296+
5297+
// PR-405 - Bugfix - fix expression after "await" mis-identified as statement.
5298+
5299+
the_await.expression = parse_expression(150);
52975300
semicolon();
52985301
} else {
5299-
the_await.expression = parse_expression();
5302+
the_await.expression = parse_expression(150);
53005303
}
53015304
return the_await;
53025305
}
@@ -8493,9 +8496,6 @@ function jslint_phase4_walk(state) {
84938496
// ["+[]", "walk_statement", "unexpected_expression_a", "+", 1]
84948497
// ["+new aa()", "walk_statement", "unexpected_expression_a", "+", 1]
84958498
// ["0", "walk_statement", "unexpected_expression_a", "0", 1]
8496-
// ["
8497-
// async function aa(){await 0;}
8498-
// ", "walk_statement", "unexpected_expression_a", "0", 27]
84998499
// ["typeof 0", "walk_statement", "unexpected_expression_a", "typeof", 1]
85008500

85018501
warn("unexpected_expression_a", thing);

test.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,10 @@ jstestDescribe((
647647
],
648648
async_await: [
649649
"async function aa() {\n await aa();\n}",
650+
651+
// PR-405 - Bugfix - fix expression after "await" mis-identified as statement.
652+
653+
"async function aa() {\n await aa;\n}",
650654
(
651655
"async function aa() {\n"
652656
+ " try {\n"

0 commit comments

Comments
 (0)