Revise ES2015 feature guards (#3240)
All the basic language element guards are merged into JERRY_ES2015 macro guard. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
committed by
Dániel Bátyai
parent
59e0d6e262
commit
3b73562fa5
@@ -44,14 +44,12 @@ typedef enum
|
||||
SCAN_MODE_STATEMENT_END, /**< scanning statement end */
|
||||
SCAN_MODE_VAR_STATEMENT, /**< scanning var statement */
|
||||
SCAN_MODE_FUNCTION_ARGUMENTS, /**< scanning function arguments */
|
||||
#if ENABLED (JERRY_ES2015_FUNCTION_PARAMETER_INITIALIZER)
|
||||
SCAN_MODE_CONTINUE_FUNCTION_ARGUMENTS, /**< continue scanning function arguments */
|
||||
#endif /* ENABLED (JERRY_ES2015_FUNCTION_PARAMETER_INITIALIZER) */
|
||||
SCAN_MODE_PROPERTY_NAME, /**< scanning property name */
|
||||
#if ENABLED (JERRY_ES2015_CLASS)
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
SCAN_MODE_CONTINUE_FUNCTION_ARGUMENTS, /**< continue scanning function arguments */
|
||||
SCAN_MODE_CLASS_DECLARATION, /**< scanning class declaration */
|
||||
SCAN_MODE_CLASS_METHOD, /**< scanning class method */
|
||||
#endif /* ENABLED (JERRY_ES2015_CLASS) */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
} scan_modes_t;
|
||||
|
||||
/**
|
||||
@@ -87,24 +85,16 @@ typedef enum
|
||||
SCAN_STACK_CATCH_STATEMENT, /**< catch statement */
|
||||
SCAN_STACK_SQUARE_BRACKETED_EXPRESSION, /**< square bracketed expression group */
|
||||
SCAN_STACK_OBJECT_LITERAL, /**< object literal group */
|
||||
#if ENABLED (JERRY_ES2015_OBJECT_INITIALIZER)
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
SCAN_STACK_COMPUTED_PROPERTY, /**< computed property name */
|
||||
#endif /* ENABLED (JERRY_ES2015_OBJECT_INITIALIZER) */
|
||||
#if ENABLED (JERRY_ES2015_TEMPLATE_STRINGS)
|
||||
SCAN_STACK_TEMPLATE_STRING, /**< template string */
|
||||
#endif /* ENABLED (JERRY_ES2015_TEMPLATE_STRINGS) */
|
||||
#if ENABLED (JERRY_ES2015_ARROW_FUNCTION)
|
||||
SCAN_STACK_ARROW_ARGUMENTS, /**< might be arguments of an arrow function */
|
||||
SCAN_STACK_ARROW_EXPRESSION, /**< expression body of an arrow function */
|
||||
#endif /* ENABLED (JERRY_ES2015_ARROW_FUNCTION) */
|
||||
#if ENABLED (JERRY_ES2015_CLASS)
|
||||
SCAN_STACK_CLASS_STATEMENT, /**< class statement */
|
||||
SCAN_STACK_CLASS_EXPRESSION, /**< class expression */
|
||||
SCAN_STACK_CLASS_EXTENDS, /**< class extends expression */
|
||||
#endif /* ENABLED (JERRY_ES2015_CLASS) */
|
||||
#if ENABLED (JERRY_ES2015_FUNCTION_PARAMETER_INITIALIZER)
|
||||
SCAN_STACK_FUNCTION_PARAMETERS, /**< function parameter initializer */
|
||||
#endif /* ENABLED (JERRY_ES2015_FUNCTION_PARAMETER_INITIALIZER) */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
} scan_stack_modes_t;
|
||||
|
||||
/**
|
||||
@@ -125,13 +115,13 @@ typedef enum
|
||||
/**
|
||||
* Checks whether token type is "of".
|
||||
*/
|
||||
#if ENABLED (JERRY_ES2015_FOR_OF)
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
#define SCANNER_IDENTIFIER_IS_OF() (lexer_compare_literal_to_identifier (context_p, "of", 2))
|
||||
#else
|
||||
#define SCANNER_IDENTIFIER_IS_OF() (false)
|
||||
#endif /* ENABLED (JERRY_ES2015_FOR_OF) */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
|
||||
#if ENABLED (JERRY_ES2015_ARROW_FUNCTION)
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
|
||||
/**
|
||||
* Init scanning the body of an arrow function.
|
||||
@@ -222,12 +212,10 @@ scanner_process_arrow_arg (parser_context_t *context_p, /**< context */
|
||||
|
||||
scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;
|
||||
|
||||
#if ENABLED (JERRY_ES2015_FUNCTION_REST_PARAMETER)
|
||||
if (context_p->token.type == LEXER_THREE_DOTS)
|
||||
{
|
||||
lexer_next_token (context_p);
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015_FUNCTION_REST_PARAMETER) */
|
||||
|
||||
if (context_p->token.type == LEXER_LITERAL
|
||||
&& context_p->token.lit_location.type == LEXER_IDENT_LITERAL)
|
||||
@@ -266,7 +254,7 @@ scanner_process_arrow_arg (parser_context_t *context_p, /**< context */
|
||||
}
|
||||
} /* scanner_process_arrow_arg */
|
||||
|
||||
#endif /* ENABLED (JERRY_ES2015_ARROW_FUNCTION) */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
|
||||
/**
|
||||
* Scan primary expression.
|
||||
@@ -310,7 +298,7 @@ scanner_scan_primary_expression (parser_context_t *context_p, /**< context */
|
||||
}
|
||||
case LEXER_LEFT_PAREN:
|
||||
{
|
||||
#if ENABLED (JERRY_ES2015_ARROW_FUNCTION)
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
parser_stack_push_uint8 (context_p, SCAN_STACK_ARROW_ARGUMENTS);
|
||||
|
||||
scanner_literal_pool_t *literal_pool_p;
|
||||
@@ -327,10 +315,10 @@ scanner_scan_primary_expression (parser_context_t *context_p, /**< context */
|
||||
|
||||
scanner_process_arrow_arg (context_p, scanner_context_p);
|
||||
return SCAN_KEEP_TOKEN;
|
||||
#else
|
||||
#else /* ENABLED (JERRY_ES2015) */
|
||||
parser_stack_push_uint8 (context_p, SCAN_STACK_PAREN_EXPRESSION);
|
||||
scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;
|
||||
#endif /* ENABLED (JERRY_ES2015_ARROW_FUNCTION) */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
break;
|
||||
}
|
||||
case LEXER_LEFT_SQUARE:
|
||||
@@ -345,7 +333,7 @@ scanner_scan_primary_expression (parser_context_t *context_p, /**< context */
|
||||
scanner_context_p->mode = SCAN_MODE_PROPERTY_NAME;
|
||||
return SCAN_KEEP_TOKEN;
|
||||
}
|
||||
#if ENABLED (JERRY_ES2015_TEMPLATE_STRINGS)
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
case LEXER_TEMPLATE_LITERAL:
|
||||
{
|
||||
if (context_p->source_p[-1] != LIT_CHAR_GRAVE_ACCENT)
|
||||
@@ -358,10 +346,10 @@ scanner_scan_primary_expression (parser_context_t *context_p, /**< context */
|
||||
/* The string is a normal string literal. */
|
||||
/* FALLTHRU */
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015_TEMPLATE_STRINGS) */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
case LEXER_LITERAL:
|
||||
{
|
||||
#if ENABLED (JERRY_ES2015_ARROW_FUNCTION)
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
const uint8_t *source_p = context_p->source_p;
|
||||
|
||||
if (context_p->token.lit_location.type == LEXER_IDENT_LITERAL
|
||||
@@ -370,7 +358,7 @@ scanner_scan_primary_expression (parser_context_t *context_p, /**< context */
|
||||
scanner_process_simple_arrow (context_p, scanner_context_p, source_p);
|
||||
return SCAN_KEEP_TOKEN;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015_ARROW_FUNCTION) */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
|
||||
if (context_p->token.lit_location.type == LEXER_IDENT_LITERAL)
|
||||
{
|
||||
@@ -387,7 +375,7 @@ scanner_scan_primary_expression (parser_context_t *context_p, /**< context */
|
||||
scanner_context_p->mode = SCAN_MODE_POST_PRIMARY_EXPRESSION;
|
||||
break;
|
||||
}
|
||||
#if ENABLED (JERRY_ES2015_CLASS)
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
case LEXER_KEYW_CLASS:
|
||||
{
|
||||
parser_stack_push_uint8 (context_p, SCAN_STACK_CLASS_EXPRESSION);
|
||||
@@ -401,7 +389,7 @@ scanner_scan_primary_expression (parser_context_t *context_p, /**< context */
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015_CLASS) */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
case LEXER_RIGHT_SQUARE:
|
||||
{
|
||||
if (stack_top != SCAN_STACK_SQUARE_BRACKETED_EXPRESSION)
|
||||
@@ -526,7 +514,7 @@ scanner_scan_primary_expression_end (parser_context_t *context_p, /**< context *
|
||||
scanner_raise_error (context_p);
|
||||
break;
|
||||
}
|
||||
#if ENABLED (JERRY_ES2015_ARROW_FUNCTION)
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
case SCAN_STACK_ARROW_ARGUMENTS:
|
||||
{
|
||||
lexer_next_token (context_p);
|
||||
@@ -537,15 +525,13 @@ scanner_scan_primary_expression_end (parser_context_t *context_p, /**< context *
|
||||
{
|
||||
break;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015_ARROW_FUNCTION) */
|
||||
#if ENABLED (JERRY_ES2015_FUNCTION_PARAMETER_INITIALIZER)
|
||||
case SCAN_STACK_FUNCTION_PARAMETERS:
|
||||
{
|
||||
scanner_context_p->mode = SCAN_MODE_CONTINUE_FUNCTION_ARGUMENTS;
|
||||
parser_stack_pop_uint8 (context_p);
|
||||
return SCAN_NEXT_TOKEN;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015_FUNCTION_PARAMETER_INITIALIZER) */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
default:
|
||||
{
|
||||
scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;
|
||||
@@ -660,11 +646,11 @@ scanner_scan_primary_expression_end (parser_context_t *context_p, /**< context *
|
||||
location_info = (scanner_location_info_t *) scanner_insert_info (context_p,
|
||||
for_statement.u.source_p,
|
||||
sizeof (scanner_location_info_t));
|
||||
#if ENABLED (JERRY_ES2015_FOR_OF)
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
location_info->info.type = (type == LEXER_KEYW_IN) ? SCANNER_TYPE_FOR_IN : SCANNER_TYPE_FOR_OF;
|
||||
#else /* !ENABLED (JERRY_ES2015_FOR_OF) */
|
||||
#else /* !ENABLED (JERRY_ES2015) */
|
||||
location_info->info.type = SCANNER_TYPE_FOR_IN;
|
||||
#endif /* ENABLED (JERRY_ES2015_FOR_OF) */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
|
||||
scanner_get_location (&location_info->location, context_p);
|
||||
|
||||
@@ -846,7 +832,7 @@ scanner_scan_primary_expression_end (parser_context_t *context_p, /**< context *
|
||||
parser_stack_pop_uint8 (context_p);
|
||||
return SCAN_NEXT_TOKEN;
|
||||
}
|
||||
#if ENABLED (JERRY_ES2015_OBJECT_INITIALIZER)
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
case SCAN_STACK_COMPUTED_PROPERTY:
|
||||
{
|
||||
if (type != LEXER_RIGHT_SQUARE)
|
||||
@@ -886,8 +872,6 @@ scanner_scan_primary_expression_end (parser_context_t *context_p, /**< context *
|
||||
scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;
|
||||
return SCAN_NEXT_TOKEN;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015_OBJECT_INITIALIZER) */
|
||||
#if ENABLED (JERRY_ES2015_TEMPLATE_STRINGS)
|
||||
case SCAN_STACK_TEMPLATE_STRING:
|
||||
{
|
||||
if (type != LEXER_RIGHT_BRACE)
|
||||
@@ -910,8 +894,6 @@ scanner_scan_primary_expression_end (parser_context_t *context_p, /**< context *
|
||||
}
|
||||
return SCAN_NEXT_TOKEN;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015_TEMPLATE_STRINGS) */
|
||||
#if ENABLED (JERRY_ES2015_ARROW_FUNCTION)
|
||||
case SCAN_STACK_ARROW_ARGUMENTS:
|
||||
{
|
||||
if (type != LEXER_RIGHT_PAREN)
|
||||
@@ -929,8 +911,6 @@ scanner_scan_primary_expression_end (parser_context_t *context_p, /**< context *
|
||||
scanner_context_p->mode = SCAN_MODE_POST_PRIMARY_EXPRESSION;
|
||||
return SCAN_KEEP_TOKEN;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015_ARROW_FUNCTION) */
|
||||
#if ENABLED (JERRY_ES2015_CLASS)
|
||||
case SCAN_STACK_CLASS_EXTENDS:
|
||||
{
|
||||
if (type != LEXER_LEFT_BRACE)
|
||||
@@ -941,8 +921,6 @@ scanner_scan_primary_expression_end (parser_context_t *context_p, /**< context *
|
||||
parser_stack_pop_uint8 (context_p);
|
||||
return SCAN_KEEP_TOKEN;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015_CLASS) */
|
||||
#if ENABLED (JERRY_ES2015_FUNCTION_PARAMETER_INITIALIZER)
|
||||
case SCAN_STACK_FUNCTION_PARAMETERS:
|
||||
{
|
||||
parser_stack_pop_uint8 (context_p);
|
||||
@@ -956,7 +934,7 @@ scanner_scan_primary_expression_end (parser_context_t *context_p, /**< context *
|
||||
scanner_context_p->mode = SCAN_MODE_CONTINUE_FUNCTION_ARGUMENTS;
|
||||
return SCAN_KEEP_TOKEN;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015_FUNCTION_PARAMETER_INITIALIZER) */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
default:
|
||||
{
|
||||
scanner_context_p->mode = SCAN_MODE_STATEMENT_END;
|
||||
@@ -1194,7 +1172,7 @@ scanner_scan_statement (parser_context_t *context_p, /**< context */
|
||||
parser_stack_push_uint8 (context_p, SCAN_STACK_FUNCTION_STATEMENT);
|
||||
return SCAN_NEXT_TOKEN;
|
||||
}
|
||||
#if ENABLED (JERRY_ES2015_CLASS)
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
case LEXER_KEYW_CLASS:
|
||||
{
|
||||
lexer_next_token (context_p);
|
||||
@@ -1211,7 +1189,7 @@ scanner_scan_statement (parser_context_t *context_p, /**< context */
|
||||
parser_stack_push_uint8 (context_p, SCAN_STACK_CLASS_STATEMENT);
|
||||
return SCAN_NEXT_TOKEN;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015_CLASS) */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#if ENABLED (JERRY_ES2015_MODULE_SYSTEM)
|
||||
case LEXER_KEYW_IMPORT:
|
||||
{
|
||||
@@ -1380,7 +1358,7 @@ scanner_scan_statement (parser_context_t *context_p, /**< context */
|
||||
scanner_context_p->mode = SCAN_MODE_FUNCTION_ARGUMENTS;
|
||||
return SCAN_KEEP_TOKEN;
|
||||
}
|
||||
#if ENABLED (JERRY_ES2015_CLASS)
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
if (context_p->token.type == LEXER_KEYW_CLASS)
|
||||
{
|
||||
scanner_context_p->mode = SCAN_MODE_CLASS_DECLARATION;
|
||||
@@ -1402,7 +1380,7 @@ scanner_scan_statement (parser_context_t *context_p, /**< context */
|
||||
location_p->type |= SCANNER_LITERAL_IS_VAR;
|
||||
return SCAN_KEEP_TOKEN;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015_CLASS) */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
|
||||
/* Assignment expression. */
|
||||
lexer_lit_location_t *location_p;
|
||||
@@ -1525,7 +1503,7 @@ scanner_scan_statement (parser_context_t *context_p, /**< context */
|
||||
|
||||
JERRY_ASSERT (context_p->token.flags & LEXER_NO_SKIP_SPACES);
|
||||
|
||||
#if ENABLED (JERRY_ES2015_ARROW_FUNCTION)
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
/* The colon needs to be checked first because the parser also checks
|
||||
* it first, and this check skips the spaces which affects source_p. */
|
||||
if (JERRY_UNLIKELY (lexer_check_arrow (context_p)))
|
||||
@@ -1533,7 +1511,7 @@ scanner_scan_statement (parser_context_t *context_p, /**< context */
|
||||
scanner_process_simple_arrow (context_p, scanner_context_p, context_p->source_p);
|
||||
return SCAN_KEEP_TOKEN;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015_ARROW_FUNCTION) */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
|
||||
scanner_add_reference (context_p, scanner_context_p);
|
||||
|
||||
@@ -1578,9 +1556,9 @@ scanner_scan_statement_end (parser_context_t *context_p, /**< context */
|
||||
break;
|
||||
}
|
||||
case SCAN_STACK_BLOCK_STATEMENT:
|
||||
#if ENABLED (JERRY_ES2015_CLASS)
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
case SCAN_STACK_CLASS_STATEMENT:
|
||||
#endif /* ENABLED (JERRY_ES2015_CLASS) */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
case SCAN_STACK_FUNCTION_STATEMENT:
|
||||
{
|
||||
if (type != LEXER_RIGHT_BRACE)
|
||||
@@ -1621,14 +1599,14 @@ scanner_scan_statement_end (parser_context_t *context_p, /**< context */
|
||||
scanner_pop_literal_pool (context_p, scanner_context_p);
|
||||
parser_stack_pop_uint8 (context_p);
|
||||
|
||||
#if ENABLED (JERRY_ES2015_CLASS)
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
if (context_p->stack_top_uint8 == SCAN_STACK_CLASS_STATEMENT
|
||||
|| context_p->stack_top_uint8 == SCAN_STACK_CLASS_EXPRESSION)
|
||||
{
|
||||
scanner_context_p->mode = SCAN_MODE_CLASS_METHOD;
|
||||
return SCAN_KEEP_TOKEN;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015_CLASS) */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
|
||||
JERRY_ASSERT (context_p->stack_top_uint8 == SCAN_STACK_OBJECT_LITERAL);
|
||||
|
||||
@@ -1908,7 +1886,7 @@ scanner_scan_all (parser_context_t *context_p, /**< context */
|
||||
}
|
||||
break;
|
||||
}
|
||||
#if ENABLED (JERRY_ES2015_CLASS)
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
case SCAN_MODE_CLASS_DECLARATION:
|
||||
{
|
||||
if (context_p->token.type == LEXER_KEYW_EXTENDS)
|
||||
@@ -1966,20 +1944,18 @@ scanner_scan_all (parser_context_t *context_p, /**< context */
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_ES2015_OBJECT_INITIALIZER)
|
||||
if (context_p->token.type == LEXER_LEFT_SQUARE)
|
||||
{
|
||||
parser_stack_push_uint8 (context_p, SCAN_STACK_COMPUTED_PROPERTY);
|
||||
scanner_context.mode = SCAN_MODE_PRIMARY_EXPRESSION;
|
||||
break;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015_OBJECT_INITIALIZER) */
|
||||
|
||||
scanner_push_literal_pool (context_p, &scanner_context, SCANNER_LITERAL_POOL_FUNCTION);
|
||||
lexer_next_token (context_p);
|
||||
continue;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015_CLASS) */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
case SCAN_MODE_POST_PRIMARY_EXPRESSION:
|
||||
{
|
||||
if (scanner_scan_post_primary_expression (context_p, &scanner_context, type))
|
||||
@@ -2096,23 +2072,23 @@ scanner_scan_all (parser_context_t *context_p, /**< context */
|
||||
}
|
||||
lexer_next_token (context_p);
|
||||
|
||||
#if ENABLED (JERRY_ES2015_FUNCTION_PARAMETER_INITIALIZER)
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
/* FALLTHRU */
|
||||
}
|
||||
case SCAN_MODE_CONTINUE_FUNCTION_ARGUMENTS:
|
||||
{
|
||||
#endif /* ENABLED (JERRY_ES2015_FUNCTION_PARAMETER_INITIALIZER) */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
|
||||
if (context_p->token.type != LEXER_RIGHT_PAREN && context_p->token.type != LEXER_EOS)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
#if ENABLED (JERRY_ES2015_FUNCTION_REST_PARAMETER)
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
if (context_p->token.type == LEXER_THREE_DOTS)
|
||||
{
|
||||
lexer_next_token (context_p);
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015_FUNCTION_REST_PARAMETER) */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
|
||||
if (context_p->token.type != LEXER_LITERAL
|
||||
|| context_p->token.lit_location.type != LEXER_IDENT_LITERAL)
|
||||
@@ -2132,14 +2108,14 @@ scanner_scan_all (parser_context_t *context_p, /**< context */
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_ES2015_FUNCTION_PARAMETER_INITIALIZER)
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
if (context_p->token.type == LEXER_ASSIGN)
|
||||
{
|
||||
parser_stack_push_uint8 (context_p, SCAN_STACK_FUNCTION_PARAMETERS);
|
||||
scanner_context.mode = SCAN_MODE_PRIMARY_EXPRESSION;
|
||||
break;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015_FUNCTION_PARAMETER_INITIALIZER) */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
|
||||
if (context_p->token.type == LEXER_EOS && stack_top == SCAN_STACK_SCRIPT_FUNCTION)
|
||||
{
|
||||
@@ -2183,14 +2159,14 @@ scanner_scan_all (parser_context_t *context_p, /**< context */
|
||||
|
||||
lexer_scan_identifier (context_p, LEXER_SCAN_IDENT_PROPERTY);
|
||||
|
||||
#if ENABLED (JERRY_ES2015_OBJECT_INITIALIZER)
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
if (context_p->token.type == LEXER_LEFT_SQUARE)
|
||||
{
|
||||
parser_stack_push_uint8 (context_p, SCAN_STACK_COMPUTED_PROPERTY);
|
||||
scanner_context.mode = SCAN_MODE_PRIMARY_EXPRESSION;
|
||||
break;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015_OBJECT_INITIALIZER) */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
|
||||
if (context_p->token.type == LEXER_RIGHT_BRACE)
|
||||
{
|
||||
@@ -2206,14 +2182,14 @@ scanner_scan_all (parser_context_t *context_p, /**< context */
|
||||
|
||||
parser_stack_push_uint8 (context_p, SCAN_STACK_FUNCTION_PROPERTY);
|
||||
|
||||
#if ENABLED (JERRY_ES2015_OBJECT_INITIALIZER)
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
if (context_p->token.type == LEXER_LEFT_SQUARE)
|
||||
{
|
||||
parser_stack_push_uint8 (context_p, SCAN_STACK_COMPUTED_PROPERTY);
|
||||
scanner_context.mode = SCAN_MODE_PRIMARY_EXPRESSION;
|
||||
break;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015_OBJECT_INITIALIZER) */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
|
||||
if (context_p->token.type != LEXER_LITERAL)
|
||||
{
|
||||
@@ -2227,15 +2203,15 @@ scanner_scan_all (parser_context_t *context_p, /**< context */
|
||||
|
||||
JERRY_ASSERT (context_p->token.type == LEXER_LITERAL);
|
||||
|
||||
#if ENABLED (JERRY_ES2015_OBJECT_INITIALIZER)
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
parser_line_counter_t start_line = context_p->token.line;
|
||||
parser_line_counter_t start_column = context_p->token.column;
|
||||
bool is_ident = (context_p->token.lit_location.type == LEXER_IDENT_LITERAL);
|
||||
#endif /* ENABLED (JERRY_ES2015_OBJECT_INITIALIZER) */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
|
||||
lexer_next_token (context_p);
|
||||
|
||||
#if ENABLED (JERRY_ES2015_OBJECT_INITIALIZER)
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
if (context_p->token.type == LEXER_LEFT_PAREN)
|
||||
{
|
||||
scanner_push_literal_pool (context_p, &scanner_context, SCANNER_LITERAL_POOL_FUNCTION);
|
||||
@@ -2277,7 +2253,7 @@ scanner_scan_all (parser_context_t *context_p, /**< context */
|
||||
scanner_context.mode = SCAN_MODE_POST_PRIMARY_EXPRESSION;
|
||||
break;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015_OBJECT_INITIALIZER) */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
|
||||
if (context_p->token.type != LEXER_COLON)
|
||||
{
|
||||
@@ -2481,14 +2457,14 @@ scan_completed:
|
||||
print_location = true;
|
||||
break;
|
||||
}
|
||||
#if ENABLED (JERRY_ES2015_FOR_OF)
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
case SCANNER_TYPE_FOR_OF:
|
||||
{
|
||||
name_p = "FOR-OF";
|
||||
print_location = true;
|
||||
break;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015_FOR_OF) */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
case SCANNER_TYPE_SWITCH:
|
||||
{
|
||||
JERRY_DEBUG_MSG (" SWITCH: source:%d\n",
|
||||
|
||||
Reference in New Issue
Block a user