Improve expected identifier checks. (#3064)

Checks for "of" or "from" does not accept quoted strings.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2019-09-05 11:42:17 +02:00
committed by Robert Fancsik
parent 086c4ebf13
commit 96edec1a62
8 changed files with 71 additions and 50 deletions
+4 -2
View File
@@ -442,7 +442,8 @@ parser_parse_class_literal (parser_context_t *context_p) /**< context */
is_computed = true;
}
else if (!(status_flags & PARSER_CLASS_STATIC_FUNCTION)
&& lexer_compare_raw_identifier_to_current (context_p, "constructor", 11))
&& LEXER_IS_IDENT_OR_STRING (context_p->token.lit_location.type)
&& lexer_compare_literal_to_string (context_p, "constructor", 11))
{
parser_raise_error (context_p, PARSER_ERR_CLASS_CONSTRUCTOR_AS_ACCESSOR);
}
@@ -538,7 +539,8 @@ parser_parse_class_literal (parser_context_t *context_p) /**< context */
is_computed = true;
}
else if ((status_flags & PARSER_CLASS_STATIC_FUNCTION)
&& lexer_compare_raw_identifier_to_current (context_p, "prototype", 9))
&& LEXER_IS_IDENT_OR_STRING (context_p->token.lit_location.type)
&& lexer_compare_literal_to_string (context_p, "prototype", 9))
{
parser_raise_error (context_p, PARSER_ERR_CLASS_STATIC_PROTOTYPE);
}