Skip to content

Commit

Permalink
Fix numeric literal with leading decimal point in accessor property n…
Browse files Browse the repository at this point in the history
…ame (jerryscript-project#4832)

JerryScript-DCO-1.0-Signed-off-by: Daniel Batiz daniel.batiz@h-lab.eu
  • Loading branch information
batizdaniel authored Nov 24, 2021
1 parent 3737a28 commit fc4168f
Showing 2 changed files with 21 additions and 19 deletions.
36 changes: 21 additions & 15 deletions jerry-core/parser/js/js-lexer.c
Original file line number Diff line number Diff line change
@@ -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;
4 changes: 0 additions & 4 deletions tests/test262-esnext-excludelist.xml
Original file line number Diff line number Diff line change
@@ -100,8 +100,6 @@
<test id="language/expressions/call/eval-spread-empty-leading.js"><reason></reason></test>
<test id="language/expressions/call/eval-spread-empty-trailing.js"><reason></reason></test>
<test id="language/expressions/call/eval-spread.js"><reason></reason></test>
<test id="language/expressions/class/accessor-name-inst/literal-numeric-leading-decimal.js"><reason></reason></test>
<test id="language/expressions/class/accessor-name-static/literal-numeric-leading-decimal.js"><reason></reason></test>
<test id="language/expressions/class/class-name-ident-let-escaped.js"><reason></reason></test>
<test id="language/expressions/class/class-name-ident-let.js"><reason></reason></test>
<test id="language/expressions/class/class-name-ident-static-escaped.js"><reason></reason></test>
@@ -307,8 +305,6 @@
<test id="language/module-code/parse-err-hoist-lex-fun.js"><reason></reason></test>
<test id="language/module-code/parse-err-hoist-lex-gen.js"><reason></reason></test>
<test id="language/statements/async-function/let-newline-await-in-async-function.js"><reason></reason></test>
<test id="language/statements/class/accessor-name-inst/literal-numeric-leading-decimal.js"><reason></reason></test>
<test id="language/statements/class/accessor-name-static/literal-numeric-leading-decimal.js"><reason></reason></test>
<test id="language/statements/class/class-name-ident-let-escaped.js"><reason></reason></test>
<test id="language/statements/class/class-name-ident-let.js"><reason></reason></test>
<test id="language/statements/class/class-name-ident-static-escaped.js"><reason></reason></test>

0 comments on commit fc4168f

Please sign in to comment.