Fix three async function issues. (#3863)

- Invalid assert
- Add missing async prefix check when an identifier is enclosed in brackets
- Adding a new byte-code

Fixes #3855
Fixes #3856
Fixes #3857

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2020-06-08 10:25:34 +02:00
committed by GitHub
parent c2c623df79
commit ab2e821777
8 changed files with 59 additions and 14 deletions
+13 -4
View File
@@ -260,7 +260,8 @@ scanner_check_async_function (parser_context_t *context_p, /**< context */
scanner_context_t *scanner_context_p) /**< scanner context */
{
JERRY_ASSERT (lexer_token_is_async (context_p));
JERRY_ASSERT (scanner_context_p->mode == SCAN_MODE_PRIMARY_EXPRESSION);
JERRY_ASSERT (scanner_context_p->mode == SCAN_MODE_PRIMARY_EXPRESSION
|| scanner_context_p->mode == SCAN_MODE_PRIMARY_EXPRESSION_AFTER_NEW);
JERRY_ASSERT (scanner_context_p->async_source_p != NULL);
lexer_lit_location_t async_literal = context_p->token.lit_location;
@@ -430,10 +431,18 @@ scanner_scan_bracket (parser_context_t *context_p, /**< context */
async_source_p = source_p;
}
}
else if (depth == total_depth - 1 && lexer_check_arrow (context_p))
else if (depth == total_depth - 1)
{
arrow_type = SCANNER_SCAN_BRACKET_ARROW_WITH_ONE_ARG;
break;
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);
}
}
arrow_source_p = NULL;