Fix scanning bracketed expressions (#4964)

Scan 'async' literal with different depth of brackets

This patch fixes #4924.
This patch fixes #4748.

JerryScript-DCO-1.0-Signed-off-by: Martin Negyokru negyokru@inf.u-szeged.hu
This commit is contained in:
mnegyokru
2022-01-13 13:48:34 +01:00
committed by GitHub
parent 5467ac4608
commit 85bad33fbf
2 changed files with 54 additions and 11 deletions
+9 -11
View File
@@ -480,18 +480,16 @@ scanner_scan_bracket (parser_context_t *context_p, /**< context */
async_source_p = source_p;
}
}
else if (depth == total_depth - 1)
{
if (lexer_check_arrow (context_p))
{
arrow_type = SCANNER_SCAN_BRACKET_ARROW_WITH_ONE_ARG;
break;
}
if (context_p->stack_top_uint8 == SCAN_STACK_USE_ASYNC)
{
scanner_add_async_literal (context_p, scanner_context_p);
}
if (depth == total_depth - 1 && lexer_check_arrow (context_p))
{
arrow_type = SCANNER_SCAN_BRACKET_ARROW_WITH_ONE_ARG;
break;
}
if (context_p->stack_top_uint8 == SCAN_STACK_USE_ASYNC)
{
scanner_add_async_literal (context_p, scanner_context_p);
}
arrow_source_p = NULL;