This fixes #619 issue on Github.
njs_queue_link_t *current)
{
njs_parser_node_t *node;
- njs_parser_scope_t *scope;
-
- scope = njs_function_scope(parser->scope);
- if (!scope->async) {
+ if (!njs_function_scope(parser->scope)->async) {
njs_parser_syntax_error(parser,
"await is only valid in async functions");
return NJS_ERROR;
}
- if (scope->in_args) {
+ if (parser->scope->in_args) {
njs_parser_syntax_error(parser, "await in arguments not supported");
return NJS_ERROR;
}
"(async function() {f('Number: ' + await 111)})"),
njs_str("SyntaxError: await in arguments not supported in 1") },
+ { njs_str("async function f1() {try {f(await f1)} catch(e) {}}"),
+ njs_str("SyntaxError: await in arguments not supported in 1") },
+
{ njs_str("async function af() {await encrypt({},}"),
njs_str("SyntaxError: Unexpected token \"}\" in 1") },