Fix pre-scanner function name parsing. (#3093)

The function names of classes were incorrectly parsed.
Also made the parsing more strict (more issues were captured by the pre-scanner).

Fixes #3088
Fixes #3089

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2019-09-11 16:55:58 +02:00
committed by Dániel Bátyai
parent fbde788d1f
commit f3d3c34c30
4 changed files with 97 additions and 33 deletions
+16
View File
@@ -2447,6 +2447,22 @@ lexer_scan_identifier (parser_context_t *context_p, /**< context */
return;
}
}
#if ENABLED (JERRY_ES2015_CLASS)
if (ident_opts & LEXER_SCAN_CLASS_PROPERTY)
{
lexer_next_token (context_p);
if (context_p->token.type == LEXER_LITERAL
#if ENABLED (JERRY_ES2015_OBJECT_INITIALIZER)
|| context_p->token.type == LEXER_LEFT_SQUARE
#endif /* ENABLED (JERRY_ES2015_OBJECT_INITIALIZER) */
|| context_p->token.type == LEXER_RIGHT_BRACE
|| context_p->token.type == LEXER_SEMICOLON)
{
return;
}
}
#endif /* ENABLED (JERRY_ES2015_CLASS) */
parser_raise_error (context_p, PARSER_ERR_IDENTIFIER_EXPECTED);
} /* lexer_scan_identifier */