Re-target for ES.Next (#3901)
A list of changes: - 'es2015-subset' profile is deprecated, and an 'es.next' profile is added. - The default profile is changed to 'es.next' - Renamed the JERRY_ES2015 guard to JERRY_ESNEXT - Renamed JERRY_ES2015_BUILTIN_* guards to JERRY_BUILTIN_* - Moved es2015 specific tests to a new 'es.next' subdirectory - Updated docs, targets, and test runners to reflect these changes Resolves #3737. JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
This commit is contained in:
+100
-100
@@ -92,7 +92,7 @@ lexer_hex_to_code_point (const uint8_t *source_p, /**< current source position *
|
||||
return result;
|
||||
} /* lexer_hex_to_code_point */
|
||||
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
|
||||
/**
|
||||
* Parse hexadecimal character sequence enclosed in braces
|
||||
@@ -146,7 +146,7 @@ lexer_hex_in_braces_to_code_point (const uint8_t *source_p, /**< current source
|
||||
return result;
|
||||
} /* lexer_hex_in_braces_to_code_point */
|
||||
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
|
||||
/**
|
||||
* Parse hexadecimal character sequence
|
||||
@@ -160,13 +160,13 @@ lexer_unchecked_hex_to_character (const uint8_t **source_p) /**< [in, out] curre
|
||||
const uint8_t *char_p = *source_p;
|
||||
uint32_t length = (char_p[-1] == LIT_CHAR_LOWERCASE_U) ? 4 : 2;
|
||||
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
if (char_p[0] == LIT_CHAR_LEFT_BRACE)
|
||||
{
|
||||
length = 0;
|
||||
char_p++;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
|
||||
while (true)
|
||||
{
|
||||
@@ -188,7 +188,7 @@ lexer_unchecked_hex_to_character (const uint8_t **source_p) /**< [in, out] curre
|
||||
|
||||
JERRY_ASSERT (result <= LIT_UNICODE_CODE_POINT_MAX);
|
||||
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
if (length == 0)
|
||||
{
|
||||
if (*char_p != LIT_CHAR_RIGHT_BRACE)
|
||||
@@ -198,7 +198,7 @@ lexer_unchecked_hex_to_character (const uint8_t **source_p) /**< [in, out] curre
|
||||
*source_p = char_p + 1;
|
||||
return result;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
|
||||
if (--length == 0)
|
||||
{
|
||||
@@ -395,7 +395,7 @@ lexer_skip_spaces (parser_context_t *context_p) /**< context */
|
||||
}
|
||||
} /* lexer_skip_spaces */
|
||||
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
/**
|
||||
* Skip all the continuous empty statements.
|
||||
*/
|
||||
@@ -413,7 +413,7 @@ lexer_skip_empty_statements (parser_context_t *context_p) /**< context */
|
||||
|
||||
context_p->token.flags = (uint8_t) (context_p->token.flags | LEXER_NO_SKIP_SPACES);
|
||||
} /* lexer_skip_empty_statements */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
|
||||
/**
|
||||
* Keyword data.
|
||||
@@ -485,10 +485,10 @@ static const keyword_string_t keywords_with_length_4[] =
|
||||
*/
|
||||
static const keyword_string_t keywords_with_length_5[] =
|
||||
{
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
LEXER_KEYWORD ("async", LEXER_KEYW_ASYNC),
|
||||
LEXER_KEYWORD ("await", LEXER_KEYW_AWAIT),
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
LEXER_KEYWORD ("break", LEXER_KEYW_BREAK),
|
||||
LEXER_KEYWORD ("catch", LEXER_KEYW_CATCH),
|
||||
LEXER_KEYWORD ("class", LEXER_KEYW_CLASS),
|
||||
@@ -641,7 +641,7 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
|
||||
|
||||
has_escape = true;
|
||||
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
if (source_p + 5 <= source_end_p && source_p[1] == LIT_CHAR_LOWERCASE_U)
|
||||
{
|
||||
if (source_p[2] == LIT_CHAR_LEFT_BRACE)
|
||||
@@ -653,12 +653,12 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
|
||||
code_point = lexer_hex_to_code_point (source_p + 2, 4);
|
||||
}
|
||||
}
|
||||
#else /* !ENABLED (JERRY_ES2015) */
|
||||
#else /* !ENABLED (JERRY_ESNEXT) */
|
||||
if (source_p + 6 <= source_end_p && source_p[1] == LIT_CHAR_LOWERCASE_U)
|
||||
{
|
||||
code_point = lexer_hex_to_code_point (source_p + 2, 4);
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
|
||||
if (code_point == UINT32_MAX)
|
||||
{
|
||||
@@ -693,13 +693,13 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
|
||||
|
||||
if (JERRY_UNLIKELY (code_point >= LIT_UTF8_2_BYTE_MARKER))
|
||||
{
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
utf8_length = lit_read_code_point_from_utf8 (source_p,
|
||||
(lit_utf8_size_t) (source_end_p - source_p),
|
||||
&code_point);
|
||||
decoded_length = utf8_length;
|
||||
|
||||
/* Only ES2015 supports code points outside of the basic plane which can be part of an identifier. */
|
||||
/* Only ES2015+ supports code points outside of the basic plane which can be part of an identifier. */
|
||||
if ((code_point >= LIT_UTF16_HIGH_SURROGATE_MIN && code_point <= LIT_UTF16_HIGH_SURROGATE_MAX)
|
||||
&& source_p + 3 < source_end_p)
|
||||
{
|
||||
@@ -722,7 +722,7 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
|
||||
decoded_length = 2 * 3;
|
||||
has_escape = true;
|
||||
}
|
||||
#else /* !ENABLED (JERRY_ES2015) */
|
||||
#else /* !ENABLED (JERRY_ESNEXT) */
|
||||
if (code_point < LIT_UTF8_4_BYTE_MARKER)
|
||||
{
|
||||
utf8_length = lit_read_code_point_from_utf8 (source_p,
|
||||
@@ -734,7 +734,7 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
|
||||
{
|
||||
code_point = 0;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
}
|
||||
|
||||
if (length == 0)
|
||||
@@ -817,7 +817,7 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
|
||||
|
||||
if (JERRY_LIKELY (keyword_p->type < LEXER_FIRST_NON_RESERVED_KEYWORD))
|
||||
{
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
if (JERRY_UNLIKELY (keyword_p->type == LEXER_KEYW_AWAIT))
|
||||
{
|
||||
if (!(context_p->status_flags & PARSER_IS_ASYNC_FUNCTION)
|
||||
@@ -838,7 +838,7 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
|
||||
context_p->token.type = (uint8_t) LEXER_KEYW_AWAIT;
|
||||
break;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
|
||||
if (ident_start_p == buffer_p)
|
||||
{
|
||||
@@ -850,7 +850,7 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
|
||||
break;
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
if (keyword_p->type == LEXER_KEYW_LET && (context_p->status_flags & PARSER_IS_STRICT))
|
||||
{
|
||||
if (ident_start_p == buffer_p)
|
||||
@@ -876,7 +876,7 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
|
||||
context_p->token.type = (uint8_t) LEXER_KEYW_YIELD;
|
||||
break;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
|
||||
if (keyword_p->type >= LEXER_FIRST_FUTURE_STRICT_RESERVED_WORD
|
||||
&& (context_p->status_flags & PARSER_IS_STRICT))
|
||||
@@ -914,11 +914,11 @@ void
|
||||
lexer_parse_string (parser_context_t *context_p, /**< context */
|
||||
lexer_string_options_t opts) /**< options */
|
||||
{
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
int32_t raw_length_adjust = 0;
|
||||
#else /* ENABLED (JERRY_ES2015) */
|
||||
#else /* ENABLED (JERRY_ESNEXT) */
|
||||
JERRY_UNUSED (opts);
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
|
||||
uint8_t str_end_character = context_p->source_p[0];
|
||||
const uint8_t *source_p = context_p->source_p + 1;
|
||||
@@ -931,12 +931,12 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
|
||||
size_t length = 0;
|
||||
uint8_t has_escape = false;
|
||||
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
if (str_end_character == LIT_CHAR_RIGHT_BRACE)
|
||||
{
|
||||
str_end_character = LIT_CHAR_GRAVE_ACCENT;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
|
||||
while (true)
|
||||
{
|
||||
@@ -971,9 +971,9 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
|
||||
if (source_p < source_end_p
|
||||
&& *source_p == LIT_CHAR_LF)
|
||||
{
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
raw_length_adjust--;
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
source_p++;
|
||||
}
|
||||
|
||||
@@ -996,7 +996,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
|
||||
continue;
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
if (opts & LEXER_STRING_RAW)
|
||||
{
|
||||
if ((*source_p == LIT_CHAR_GRAVE_ACCENT) || (*source_p == LIT_CHAR_BACKSLASH))
|
||||
@@ -1007,7 +1007,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
|
||||
}
|
||||
continue;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
|
||||
if (*source_p == LIT_CHAR_0
|
||||
&& source_p + 1 < source_end_p
|
||||
@@ -1084,7 +1084,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
|
||||
context_p->token.line = line;
|
||||
context_p->token.column = (parser_line_counter_t) (column - 1);
|
||||
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
if (source_p + 4 <= source_end_p
|
||||
&& source_p[0] == LIT_CHAR_LOWERCASE_U
|
||||
&& source_p[1] == LIT_CHAR_LEFT_BRACE)
|
||||
@@ -1094,14 +1094,14 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
if (source_p + escape_length <= source_end_p)
|
||||
{
|
||||
code_point = lexer_hex_to_code_point (source_p + 1, escape_length - 1);
|
||||
}
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
|
||||
if (code_point == UINT32_MAX)
|
||||
{
|
||||
@@ -1115,7 +1115,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
else if (str_end_character == LIT_CHAR_GRAVE_ACCENT &&
|
||||
source_p[0] == LIT_CHAR_DOLLAR_SIGN &&
|
||||
source_p + 1 < source_end_p &&
|
||||
@@ -1125,7 +1125,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
|
||||
source_p++;
|
||||
break;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
|
||||
if (*source_p >= LIT_UTF8_4_BYTE_MARKER)
|
||||
{
|
||||
@@ -1135,9 +1135,9 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
|
||||
length += 2 * 3;
|
||||
has_escape = true;
|
||||
source_p += 4;
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
raw_length_adjust += 2;
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
column++;
|
||||
continue;
|
||||
}
|
||||
@@ -1147,7 +1147,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
|
||||
/* Subtract -1 because column is increased below. */
|
||||
column--;
|
||||
}
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
else if (str_end_character == LIT_CHAR_GRAVE_ACCENT)
|
||||
{
|
||||
/* Newline (without backslash) is part of the string.
|
||||
@@ -1184,7 +1184,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
else if (*source_p == LIT_CHAR_CR
|
||||
|| *source_p == LIT_CHAR_LF
|
||||
|| (*source_p == LEXER_NEWLINE_LS_PS_BYTE_1 && LEXER_NEWLINE_LS_PS_BYTE_23 (source_p)))
|
||||
@@ -1206,24 +1206,24 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
if (opts & LEXER_STRING_RAW)
|
||||
{
|
||||
length = (size_t) ((source_p - string_start_p) + raw_length_adjust);
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
|
||||
if (length > PARSER_MAXIMUM_STRING_LENGTH)
|
||||
{
|
||||
parser_raise_error (context_p, PARSER_ERR_STRING_TOO_LONG);
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
context_p->token.type = ((str_end_character != LIT_CHAR_GRAVE_ACCENT) ? LEXER_LITERAL
|
||||
: LEXER_TEMPLATE_LITERAL);
|
||||
#else /* !ENABLED (JERRY_ES2015) */
|
||||
#else /* !ENABLED (JERRY_ESNEXT) */
|
||||
context_p->token.type = LEXER_LITERAL;
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
|
||||
/* Fill literal data. */
|
||||
context_p->token.lit_location.char_p = string_start_p;
|
||||
@@ -1297,7 +1297,7 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
|
||||
while (source_p < source_end_p
|
||||
&& lit_char_is_hex_digit (source_p[0]));
|
||||
}
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
else if (LEXER_TO_ASCII_LOWERCASE (source_p[1]) == LIT_CHAR_LOWERCASE_O)
|
||||
{
|
||||
context_p->token.extra_value = LEXER_NUMBER_OCTAL;
|
||||
@@ -1313,7 +1313,7 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
|
||||
|
||||
lexer_parse_octal_number (context_p, &source_p);
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
else if (source_p[1] >= LIT_CHAR_0
|
||||
&& source_p[1] <= LIT_CHAR_7)
|
||||
{
|
||||
@@ -1331,7 +1331,7 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
|
||||
{
|
||||
parser_raise_error (context_p, PARSER_ERR_INVALID_NUMBER);
|
||||
}
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
else if (LEXER_TO_ASCII_LOWERCASE (source_p[1]) == LIT_CHAR_LOWERCASE_B)
|
||||
{
|
||||
context_p->token.extra_value = LEXER_NUMBER_BINARY;
|
||||
@@ -1352,7 +1352,7 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
|
||||
while (source_p < source_end_p
|
||||
&& lit_char_is_binary_digit (source_p[0]));
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
else
|
||||
{
|
||||
can_be_float = true;
|
||||
@@ -1552,7 +1552,7 @@ lexer_next_token (parser_context_t *context_p) /**< context */
|
||||
return;
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
if (length >= 3
|
||||
&& context_p->source_p[1] == LIT_CHAR_DOT
|
||||
&& context_p->source_p[2] == LIT_CHAR_DOT)
|
||||
@@ -1561,7 +1561,7 @@ lexer_next_token (parser_context_t *context_p) /**< context */
|
||||
length = 3;
|
||||
break;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
|
||||
context_p->token.type = LEXER_DOT;
|
||||
length = 1;
|
||||
@@ -1665,14 +1665,14 @@ lexer_next_token (parser_context_t *context_p) /**< context */
|
||||
break;
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
if (context_p->source_p[1] == (uint8_t) LIT_CHAR_GREATER_THAN)
|
||||
{
|
||||
context_p->token.type = LEXER_ARROW;
|
||||
length = 2;
|
||||
break;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
}
|
||||
|
||||
context_p->token.type = LEXER_ASSIGN;
|
||||
@@ -1717,7 +1717,7 @@ lexer_next_token (parser_context_t *context_p) /**< context */
|
||||
break;
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
if (context_p->source_p[1] == (uint8_t) LIT_CHAR_ASTERISK)
|
||||
{
|
||||
if (length >= 3 && context_p->source_p[2] == (uint8_t) LIT_CHAR_EQUALS)
|
||||
@@ -1731,7 +1731,7 @@ lexer_next_token (parser_context_t *context_p) /**< context */
|
||||
length = 2;
|
||||
break;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
}
|
||||
|
||||
context_p->token.type = LEXER_MULTIPLY;
|
||||
@@ -1758,9 +1758,9 @@ lexer_next_token (parser_context_t *context_p) /**< context */
|
||||
|
||||
case LIT_CHAR_SINGLE_QUOTE:
|
||||
case LIT_CHAR_DOUBLE_QUOTE:
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
case LIT_CHAR_GRAVE_ACCENT:
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
{
|
||||
lexer_parse_string (context_p, LEXER_STRING_NO_OPTS);
|
||||
return;
|
||||
@@ -1867,9 +1867,9 @@ lexer_check_post_primary_exp (parser_context_t *context_p) /**< context */
|
||||
case LIT_CHAR_DOT:
|
||||
case LIT_CHAR_LEFT_PAREN:
|
||||
case LIT_CHAR_LEFT_SQUARE:
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
case LIT_CHAR_GRAVE_ACCENT:
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -1880,19 +1880,19 @@ lexer_check_post_primary_exp (parser_context_t *context_p) /**< context */
|
||||
&& context_p->source_p + 1 < context_p->source_end_p
|
||||
&& context_p->source_p[1] == context_p->source_p[0]);
|
||||
}
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
case LIT_CHAR_ASTERISK:
|
||||
{
|
||||
return (context_p->source_p + 1 < context_p->source_end_p
|
||||
&& context_p->source_p[1] == (uint8_t) LIT_CHAR_ASTERISK);
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
}
|
||||
|
||||
return false;
|
||||
} /* lexer_check_post_primary_exp */
|
||||
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
|
||||
/**
|
||||
* Checks whether the next token is a type used for detecting arrow functions.
|
||||
@@ -2050,7 +2050,7 @@ lexer_update_await_yield (parser_context_t *context_p, /**< context */
|
||||
}
|
||||
} /* lexer_update_await_yield */
|
||||
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
|
||||
/**
|
||||
* Convert an ident with escapes to a utf8 string.
|
||||
@@ -2074,7 +2074,7 @@ lexer_convert_ident_to_cesu8 (uint8_t *destination_p, /**< destination string */
|
||||
continue;
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
if (*source_p >= LIT_UTF8_4_BYTE_MARKER)
|
||||
{
|
||||
lit_four_byte_utf8_char_to_cesu8 (destination_p, source_p);
|
||||
@@ -2083,7 +2083,7 @@ lexer_convert_ident_to_cesu8 (uint8_t *destination_p, /**< destination string */
|
||||
source_p += 4;
|
||||
continue;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
|
||||
*destination_p++ = *source_p++;
|
||||
}
|
||||
@@ -2129,17 +2129,17 @@ lexer_convert_literal_to_chars (parser_context_t *context_p, /**< context */
|
||||
|
||||
uint8_t str_end_character = source_p[-1];
|
||||
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
if (str_end_character == LIT_CHAR_RIGHT_BRACE)
|
||||
{
|
||||
str_end_character = LIT_CHAR_GRAVE_ACCENT;
|
||||
}
|
||||
|
||||
bool is_raw = (opts & LEXER_STRING_RAW) != 0;
|
||||
#else /* !ENABLED (JERRY_ES2015) */
|
||||
#else /* !ENABLED (JERRY_ESNEXT) */
|
||||
JERRY_UNUSED (opts);
|
||||
bool is_raw = false;
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
|
||||
while (true)
|
||||
{
|
||||
@@ -2271,7 +2271,7 @@ lexer_convert_literal_to_chars (parser_context_t *context_p, /**< context */
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
else if (str_end_character == LIT_CHAR_GRAVE_ACCENT)
|
||||
{
|
||||
if (source_p[0] == LIT_CHAR_DOLLAR_SIGN
|
||||
@@ -2303,7 +2303,7 @@ lexer_convert_literal_to_chars (parser_context_t *context_p, /**< context */
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
|
||||
if (*source_p >= LIT_UTF8_4_BYTE_MARKER)
|
||||
{
|
||||
@@ -2477,12 +2477,12 @@ lexer_construct_number_object (parser_context_t *context_p, /**< context */
|
||||
const uint8_t *src_end_p = src_p + length - 1;
|
||||
ecma_number_t multiplier = 8.0;
|
||||
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
if (context_p->token.extra_value == LEXER_NUMBER_BINARY)
|
||||
{
|
||||
multiplier = 2.0;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
|
||||
num = 0;
|
||||
do
|
||||
@@ -2659,7 +2659,7 @@ lexer_construct_function_object (parser_context_t *context_p, /**< context */
|
||||
result_index = context_p->literal_count;
|
||||
context_p->literal_count++;
|
||||
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
if (!(extra_status_flags & PARSER_IS_ARROW_FUNCTION))
|
||||
{
|
||||
compiled_code_p = parser_parse_function (context_p, extra_status_flags);
|
||||
@@ -2668,9 +2668,9 @@ lexer_construct_function_object (parser_context_t *context_p, /**< context */
|
||||
{
|
||||
compiled_code_p = parser_parse_arrow_function (context_p, extra_status_flags);
|
||||
}
|
||||
#else /* !ENABLED (JERRY_ES2015) */
|
||||
#else /* !ENABLED (JERRY_ESNEXT) */
|
||||
compiled_code_p = parser_parse_function (context_p, extra_status_flags);
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
|
||||
literal_p->u.bytecode_p = compiled_code_p;
|
||||
literal_p->type = LEXER_FUNCTION_LITERAL;
|
||||
@@ -2927,7 +2927,7 @@ lexer_expect_identifier (parser_context_t *context_p, /**< context */
|
||||
return;
|
||||
}
|
||||
}
|
||||
#if ENABLED (JERRY_ES2015_MODULE_SYSTEM)
|
||||
#if ENABLED (JERRY_MODULE_SYSTEM)
|
||||
else if (context_p->status_flags & PARSER_MODULE_DEFAULT_CLASS_OR_FUNC)
|
||||
{
|
||||
/* When parsing default exports for modules, it is not required by functions or classes to have identifiers.
|
||||
@@ -2939,9 +2939,9 @@ lexer_expect_identifier (parser_context_t *context_p, /**< context */
|
||||
context_p->status_flags &= (uint32_t) ~(PARSER_MODULE_DEFAULT_CLASS_OR_FUNC);
|
||||
return;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015_MODULE_SYSTEM) */
|
||||
#endif /* ENABLED (JERRY_MODULE_SYSTEM) */
|
||||
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
if (context_p->token.type == LEXER_KEYW_YIELD)
|
||||
{
|
||||
parser_raise_error (context_p, PARSER_ERR_YIELD_NOT_ALLOWED);
|
||||
@@ -2950,7 +2950,7 @@ lexer_expect_identifier (parser_context_t *context_p, /**< context */
|
||||
{
|
||||
parser_raise_error (context_p, PARSER_ERR_AWAIT_NOT_ALLOWED);
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
parser_raise_error (context_p, PARSER_ERR_IDENTIFIER_EXPECTED);
|
||||
} /* lexer_expect_identifier */
|
||||
|
||||
@@ -2968,11 +2968,11 @@ lexer_expect_object_literal_id (parser_context_t *context_p, /**< context */
|
||||
parser_raise_error (context_p, PARSER_ERR_PROPERTY_IDENTIFIER_EXPECTED);
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
int is_class_method = ((ident_opts & LEXER_OBJ_IDENT_CLASS_METHOD)
|
||||
&& !(ident_opts & LEXER_OBJ_IDENT_ONLY_IDENTIFIERS)
|
||||
&& (context_p->token.type != LEXER_KEYW_STATIC));
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
|
||||
context_p->token.line = context_p->line;
|
||||
context_p->token.column = context_p->column;
|
||||
@@ -2986,11 +2986,11 @@ lexer_expect_object_literal_id (parser_context_t *context_p, /**< context */
|
||||
context_p->token.flags = (uint8_t) (context_p->token.flags | LEXER_NO_SKIP_SPACES);
|
||||
|
||||
if (context_p->source_p < context_p->source_end_p
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
&& context_p->source_p[0] != LIT_CHAR_COMMA
|
||||
&& context_p->source_p[0] != LIT_CHAR_RIGHT_BRACE
|
||||
&& context_p->source_p[0] != LIT_CHAR_LEFT_PAREN
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
&& context_p->source_p[0] != LIT_CHAR_COLON)
|
||||
{
|
||||
if (lexer_compare_literal_to_string (context_p, "get", 3))
|
||||
@@ -3005,23 +3005,23 @@ lexer_expect_object_literal_id (parser_context_t *context_p, /**< context */
|
||||
return;
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
if (lexer_compare_literal_to_string (context_p, "async", 5))
|
||||
{
|
||||
context_p->token.type = LEXER_KEYW_ASYNC;
|
||||
return;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
if (is_class_method && lexer_compare_literal_to_string (context_p, "static", 6))
|
||||
{
|
||||
context_p->token.type = LEXER_KEYW_STATIC;
|
||||
return;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
|
||||
create_literal_object = true;
|
||||
}
|
||||
@@ -3036,7 +3036,7 @@ lexer_expect_object_literal_id (parser_context_t *context_p, /**< context */
|
||||
create_literal_object = true;
|
||||
break;
|
||||
}
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
case LIT_CHAR_LEFT_SQUARE:
|
||||
{
|
||||
lexer_consume_next_character (context_p);
|
||||
@@ -3061,7 +3061,7 @@ lexer_expect_object_literal_id (parser_context_t *context_p, /**< context */
|
||||
lexer_consume_next_character (context_p);
|
||||
return;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
case LIT_CHAR_RIGHT_BRACE:
|
||||
{
|
||||
if (ident_opts & LEXER_OBJ_IDENT_ONLY_IDENTIFIERS)
|
||||
@@ -3097,14 +3097,14 @@ lexer_expect_object_literal_id (parser_context_t *context_p, /**< context */
|
||||
|
||||
if (create_literal_object)
|
||||
{
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
if (is_class_method && lexer_compare_literal_to_string (context_p, "constructor", 11))
|
||||
{
|
||||
context_p->token.type = LEXER_CLASS_CONSTRUCTOR;
|
||||
context_p->token.flags &= (uint8_t) ~LEXER_NO_SKIP_SPACES;
|
||||
return;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
|
||||
lexer_construct_literal_object (context_p,
|
||||
&context_p->token.lit_location,
|
||||
@@ -3151,12 +3151,12 @@ lexer_check_property_modifier (parser_context_t *context_p) /**< context */
|
||||
context_p->token.flags = (uint8_t) (context_p->token.flags | LEXER_NO_SKIP_SPACES);
|
||||
|
||||
if (context_p->source_p >= context_p->source_end_p
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
|| context_p->source_p[0] == LIT_CHAR_COMMA
|
||||
|| context_p->source_p[0] == LIT_CHAR_RIGHT_BRACE
|
||||
|| context_p->source_p[0] == LIT_CHAR_LEFT_PAREN
|
||||
|| context_p->source_p[0] == LIT_CHAR_EQUALS
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
|| context_p->source_p[0] == LIT_CHAR_COLON)
|
||||
{
|
||||
return;
|
||||
@@ -3174,13 +3174,13 @@ lexer_check_property_modifier (parser_context_t *context_p) /**< context */
|
||||
return;
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
if (lexer_compare_literal_to_string (context_p, "async", 5))
|
||||
{
|
||||
context_p->token.type = LEXER_KEYW_ASYNC;
|
||||
return;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
} /* lexer_check_property_modifier */
|
||||
|
||||
/**
|
||||
@@ -3386,7 +3386,7 @@ lexer_string_is_directive (parser_context_t *context_p) /**< context */
|
||||
&& context_p->token.type != LEXER_DOT));
|
||||
} /* lexer_string_is_directive */
|
||||
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
|
||||
/**
|
||||
* Compares the current token to an expected identifier.
|
||||
@@ -3443,7 +3443,7 @@ lexer_token_is_async (parser_context_t *context_p) /**< context */
|
||||
&& !context_p->token.lit_location.has_escape);
|
||||
} /* lexer_token_is_async */
|
||||
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
|
||||
/**
|
||||
* Compares the current identifier or string to an expected string.
|
||||
@@ -3480,17 +3480,17 @@ lexer_convert_binary_lvalue_token_to_binary (uint8_t token) /**< binary lvalue t
|
||||
JERRY_ASSERT (LEXER_IS_BINARY_LVALUE_TOKEN (token));
|
||||
JERRY_ASSERT (token != LEXER_ASSIGN);
|
||||
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
if (token <= LEXER_ASSIGN_EXPONENTIATION)
|
||||
{
|
||||
return (uint8_t) (LEXER_ADD + (token - LEXER_ASSIGN_ADD));
|
||||
}
|
||||
#else /* !ENABLED (JERRY_ES2015) */
|
||||
#else /* !ENABLED (JERRY_ESNEXT) */
|
||||
if (token <= LEXER_ASSIGN_MODULO)
|
||||
{
|
||||
return (uint8_t) (LEXER_ADD + (token - LEXER_ASSIGN_ADD));
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
|
||||
if (token <= LEXER_ASSIGN_UNS_RIGHT_SHIFT)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user