Skip to content

Commit

Permalink
- bugfix - fix expression after "await" mis-identified as statement (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
kaizhu256 authored Jun 21, 2022
1 parent 878a573 commit df3491f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- node - after node-v14 is deprecated, remove shell-code `export "NODE_OPTIONS=--unhandled-rejections=strict"`.

# v2022.6.1-beta
- bugfix - fix expression after "await" mis-identified as statement
- directive - add new directive `subscript` for linting of scripts targeting Google Closure Compiler
- warning - relax warning about missing `catch` in `try...finally` statement
- jslint - allow aliases `evil, nomen` for jslint-directives `eval, name`, respectively for backwards-compat
Expand Down
10 changes: 5 additions & 5 deletions jslint.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5293,10 +5293,13 @@ function jslint_phase3_parse(state) {
functionage.async += 1;
}
if (the_await.arity === "statement") {
the_await.block = parse_expression();

// PR-405 - Bugfix - fix expression after "await" mis-identified as statement.

the_await.expression = parse_expression(150);
semicolon();
} else {
the_await.expression = parse_expression();
the_await.expression = parse_expression(150);
}
return the_await;
}
Expand Down Expand Up @@ -8493,9 +8496,6 @@ function jslint_phase4_walk(state) {
// ["+[]", "walk_statement", "unexpected_expression_a", "+", 1]
// ["+new aa()", "walk_statement", "unexpected_expression_a", "+", 1]
// ["0", "walk_statement", "unexpected_expression_a", "0", 1]
// ["
// async function aa(){await 0;}
// ", "walk_statement", "unexpected_expression_a", "0", 27]
// ["typeof 0", "walk_statement", "unexpected_expression_a", "typeof", 1]

warn("unexpected_expression_a", thing);
Expand Down
4 changes: 4 additions & 0 deletions test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,10 @@ jstestDescribe((
],
async_await: [
"async function aa() {\n await aa();\n}",

// PR-405 - Bugfix - fix expression after "await" mis-identified as statement.

"async function aa() {\n await aa;\n}",
(
"async function aa() {\n"
+ " try {\n"
Expand Down

0 comments on commit df3491f

Please sign in to comment.