Rework simple arrow function scanning. (#3148)

The resulting code unifies the scanning of the two
different argument definition of arrow functions.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2019-09-23 15:25:37 +02:00
committed by Dániel Bátyai
parent 053b05f185
commit 5c7df1cb2d
3 changed files with 92 additions and 48 deletions
+4 -2
View File
@@ -1217,9 +1217,11 @@ parser_parse_unary_expression (parser_context_t *context_p, /**< context */
case LEXER_LITERAL:
{
#if ENABLED (JERRY_ES2015_ARROW_FUNCTION)
if (context_p->token.lit_location.type == LEXER_IDENT_LITERAL
&& lexer_check_arrow (context_p))
if (context_p->next_scanner_info_p->source_p == context_p->source_p)
{
JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_ARROW);
scanner_release_next (context_p, sizeof (scanner_info_t));
parser_parse_function_expression (context_p,
PARSER_IS_FUNCTION | PARSER_IS_ARROW_FUNCTION);
return;