Check for prototype bound name in class static accessors (#4257)

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
This commit is contained in:
Dániel Bátyai
2020-10-16 17:02:17 +02:00
committed by GitHub
parent d8955552d7
commit 080abb94ca
4 changed files with 22 additions and 7 deletions
+11 -2
View File
@@ -621,8 +621,17 @@ parser_parse_class_body (parser_context_t *context_p, /**< context */
{
is_computed = true;
}
else if (!is_static && parser_is_constructor_literal (context_p))
else if (is_static)
{
if (LEXER_IS_IDENT_OR_STRING (context_p->token.lit_location.type)
&& lexer_compare_identifier_to_string (&context_p->token.lit_location, (uint8_t *) "prototype", 9))
{
parser_raise_error (context_p, PARSER_ERR_CLASS_STATIC_PROTOTYPE);
}
}
else if (parser_is_constructor_literal (context_p))
{
JERRY_ASSERT (!is_static);
parser_raise_error (context_p, PARSER_ERR_CLASS_CONSTRUCTOR_AS_ACCESSOR);
}
@@ -705,7 +714,7 @@ parser_parse_class_body (parser_context_t *context_p, /**< context */
{
if (is_static)
{
if (lexer_compare_literal_to_string (context_p, "prototype", 9))
if (lexer_compare_identifier_to_string (&context_p->token.lit_location, (uint8_t *) "prototype", 9))
{
parser_raise_error (context_p, PARSER_ERR_CLASS_STATIC_PROTOTYPE);
}