}
+static njs_int_t
+njs_parser_tagged_template_literal_after(njs_parser_t *parser,
+ njs_lexer_token_t *token, njs_queue_link_t *current)
+{
+ parser->scope->in_tagged_template--;
+
+ return njs_parser_stack_pop(parser);
+}
+
/*
* 12.3 Left-Hand-Side Expressions.
*/
parser->node = node;
+ parser->scope->in_tagged_template++;
+
njs_parser_next(parser, njs_parser_template_literal);
- break;
+ return njs_parser_after(parser, current, node, 1,
+ njs_parser_tagged_template_literal_after);
default:
return NJS_DONE;
return NJS_ERROR;
}
+ if (parser->scope->in_tagged_template > 0) {
+ njs_parser_syntax_error(parser,
+ "await in tagged template not supported");
+ return NJS_ERROR;
+ }
+
node = njs_parser_node_new(parser, NJS_TOKEN_AWAIT);
if (njs_slow_path(node == NULL)) {
return NJS_ERROR;
{ 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 (){}) `${(async () => 1)(await 1)}`)()"),
+ njs_str("SyntaxError: await in arguments not supported in 1") },
+
+ { njs_str("(async () => (function (){}) `${await 1}`)()"),
+ njs_str("SyntaxError: await in tagged template not supported in 1") },
+
{ njs_str("async function af() {await encrypt({},}"),
njs_str("SyntaxError: Unexpected token \"}\" in 1") },