Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- bugfix - fix expression after "await" mis-identified as statement #405

Merged
merged 1 commit into from
Jun 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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