Fix numeric literal with leading decimal point in accessor property name (#4832)

JerryScript-DCO-1.0-Signed-off-by: Daniel Batiz daniel.batiz@h-lab.eu
This commit is contained in:
batizdaniel
2021-11-24 17:07:57 +01:00
committed by GitHub
parent 3737a28eaf
commit fc4168f2b4
2 changed files with 21 additions and 19 deletions
+21 -15
View File
@@ -3186,21 +3186,6 @@ lexer_expect_object_literal_id (parser_context_t *context_p, /**< context */
lexer_consume_next_character (context_p);
return;
}
case LIT_CHAR_DOT:
{
if ((ident_opts & ((uint32_t) ~(LEXER_OBJ_IDENT_OBJECT_PATTERN | LEXER_OBJ_IDENT_SET_FUNCTION_START)))
|| context_p->source_p + 2 >= context_p->source_end_p || context_p->source_p[1] != LIT_CHAR_DOT
|| context_p->source_p[2] != LIT_CHAR_DOT)
{
break;
}
context_p->token.type = LEXER_THREE_DOTS;
context_p->token.flags &= (uint8_t) ~LEXER_NO_SKIP_SPACES;
PARSER_PLUS_EQUAL_LC (context_p->column, 3);
context_p->source_p += 3;
return;
}
#endif /* JERRY_ESNEXT */
case LIT_CHAR_RIGHT_BRACE:
{
@@ -3213,6 +3198,27 @@ lexer_expect_object_literal_id (parser_context_t *context_p, /**< context */
lexer_consume_next_character (context_p);
return;
}
#if JERRY_ESNEXT
case LIT_CHAR_DOT:
{
if (!(context_p->source_p + 1 >= context_p->source_end_p || lit_char_is_decimal_digit (context_p->source_p[1])))
{
if ((ident_opts & ((uint32_t) ~(LEXER_OBJ_IDENT_OBJECT_PATTERN | LEXER_OBJ_IDENT_SET_FUNCTION_START)))
|| context_p->source_p + 2 >= context_p->source_end_p || context_p->source_p[1] != LIT_CHAR_DOT
|| context_p->source_p[2] != LIT_CHAR_DOT)
{
break;
}
context_p->token.type = LEXER_THREE_DOTS;
context_p->token.flags &= (uint8_t) ~LEXER_NO_SKIP_SPACES;
PARSER_PLUS_EQUAL_LC (context_p->column, 3);
context_p->source_p += 3;
return;
}
/* FALLTHRU */
}
#endif /* JERRY_ESNEXT */
default:
{
const uint8_t *char_p = context_p->source_p;