Remove ES_NEXT macro (#4915)
- remove all '#JERRY_ESNEXT' macro - remove 5.1 build profile, update test runner accordingly (Note: all builtins are turn on by default) - move tests from tests/jerry/esnext into tests/jerry, concatenate files with same names - add skiplist to some snapshot tests that were supported only in 5.1 - fix doxygen issues that were hidden before (bc. of es.next macro) Co-authored-by: Martin Negyokru negyokru@inf.u-szeged.hu JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
This commit is contained in:
@@ -41,13 +41,11 @@ typedef enum
|
||||
SCAN_MODE_VAR_STATEMENT, /**< scanning var statement */
|
||||
SCAN_MODE_PROPERTY_NAME, /**< scanning property name */
|
||||
SCAN_MODE_FUNCTION_ARGUMENTS, /**< scanning function arguments */
|
||||
#if JERRY_ESNEXT
|
||||
SCAN_MODE_CONTINUE_FUNCTION_ARGUMENTS, /**< continue scanning function arguments */
|
||||
SCAN_MODE_BINDING, /**< array or object binding */
|
||||
SCAN_MODE_CLASS_DECLARATION, /**< scanning class declaration */
|
||||
SCAN_MODE_CLASS_BODY, /**< scanning class body */
|
||||
SCAN_MODE_CLASS_BODY_NO_SCAN, /**< scanning class body without calling lexer_scan_identifier */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
} scan_modes_t;
|
||||
|
||||
/**
|
||||
@@ -61,9 +59,7 @@ typedef enum
|
||||
SCAN_STACK_FUNCTION_STATEMENT, /**< function statement */
|
||||
SCAN_STACK_FUNCTION_EXPRESSION, /**< function expression */
|
||||
SCAN_STACK_FUNCTION_PROPERTY, /**< function expression in an object literal */
|
||||
#if JERRY_ESNEXT
|
||||
SCAN_STACK_FUNCTION_ARROW, /**< arrow function expression */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
SCAN_STACK_SWITCH_BLOCK, /**< block part of "switch" statement */
|
||||
SCAN_STACK_IF_STATEMENT, /**< statement part of "if" statements */
|
||||
SCAN_STACK_WITH_STATEMENT, /**< statement part of "with" statements */
|
||||
@@ -73,19 +69,15 @@ typedef enum
|
||||
SCAN_STACK_WHILE_EXPRESSION, /**< expression part of "while" iterator */
|
||||
SCAN_STACK_PAREN_EXPRESSION, /**< expression in brackets */
|
||||
SCAN_STACK_STATEMENT_WITH_EXPR, /**< statement which starts with expression enclosed in brackets */
|
||||
#if JERRY_ESNEXT
|
||||
SCAN_STACK_BINDING_INIT, /**< post processing after a single initializer */
|
||||
SCAN_STACK_BINDING_LIST_INIT, /**< post processing after an initializer list */
|
||||
SCAN_STACK_LET, /**< let statement */
|
||||
SCAN_STACK_CONST, /**< const statement */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
/* The SCANNER_IS_FOR_START macro needs to be updated when the following constants are reordered. */
|
||||
SCAN_STACK_VAR, /**< var statement */
|
||||
SCAN_STACK_FOR_VAR_START, /**< start of "for" iterator with var statement */
|
||||
#if JERRY_ESNEXT
|
||||
SCAN_STACK_FOR_LET_START, /**< start of "for" iterator with let statement */
|
||||
SCAN_STACK_FOR_CONST_START, /**< start of "for" iterator with const statement */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
SCAN_STACK_FOR_START, /**< start of "for" iterator */
|
||||
SCAN_STACK_FOR_CONDITION, /**< condition part of "for" iterator */
|
||||
SCAN_STACK_FOR_EXPRESSION, /**< expression part of "for" iterator */
|
||||
@@ -97,7 +89,6 @@ typedef enum
|
||||
SCAN_STACK_ARRAY_LITERAL, /**< array literal or destructuring assignment or binding */
|
||||
SCAN_STACK_OBJECT_LITERAL, /**< object literal group */
|
||||
SCAN_STACK_PROPERTY_ACCESSOR, /**< property accessor in square brackets */
|
||||
#if JERRY_ESNEXT
|
||||
/* These four must be in this order. */
|
||||
SCAN_STACK_COMPUTED_PROPERTY, /**< computed property name */
|
||||
SCAN_STACK_COMPUTED_GENERATOR, /**< computed generator function */
|
||||
@@ -119,7 +110,6 @@ typedef enum
|
||||
SCAN_STACK_FOR_START_PATTERN, /**< possible assignment pattern for "for" iterator */
|
||||
SCAN_STACK_USE_ASYNC, /**< an "async" identifier is used */
|
||||
SCAN_STACK_CLASS_STATIC_BLOCK, /**< class static block */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
#if JERRY_MODULE_SYSTEM
|
||||
SCAN_STACK_EXPORT_DEFAULT, /**< scan primary expression after export default */
|
||||
#endif /* JERRY_MODULE_SYSTEM */
|
||||
@@ -131,9 +121,7 @@ typedef enum
|
||||
typedef enum
|
||||
{
|
||||
SCANNER_CONTEXT_NO_FLAGS = 0, /**< no flags are set */
|
||||
#if JERRY_ESNEXT
|
||||
SCANNER_CONTEXT_THROW_ERR_ASYNC_FUNCTION = (1 << 0), /**< throw async function error */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
#if JERRY_DEBUGGER
|
||||
SCANNER_CONTEXT_DEBUGGER_ENABLED = (1 << 1), /**< debugger is enabled */
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
@@ -167,24 +155,18 @@ typedef enum
|
||||
{
|
||||
SCANNER_LITERAL_IS_ARG = (1 << 0), /**< literal is argument */
|
||||
SCANNER_LITERAL_IS_VAR = (1 << 1), /**< literal is var */
|
||||
#if JERRY_ESNEXT
|
||||
/** literal is a destructured argument binding of a possible arrow function */
|
||||
SCANNER_LITERAL_IS_ARROW_DESTRUCTURED_ARG = SCANNER_LITERAL_IS_VAR,
|
||||
#endif /* JERRY_ESNEXT */
|
||||
SCANNER_LITERAL_IS_FUNC = (1 << 2), /**< literal is function */
|
||||
SCANNER_LITERAL_NO_REG = (1 << 3), /**< literal cannot be stored in a register */
|
||||
SCANNER_LITERAL_IS_LET = (1 << 4), /**< literal is let */
|
||||
#if JERRY_ESNEXT
|
||||
/** literal is a function declared in this block (prevents declaring let/const with the same name) */
|
||||
SCANNER_LITERAL_IS_FUNC_DECLARATION = SCANNER_LITERAL_IS_LET,
|
||||
#endif /* JERRY_ESNEXT */
|
||||
SCANNER_LITERAL_IS_CONST = (1 << 5), /**< literal is const */
|
||||
#if JERRY_ESNEXT
|
||||
/** literal is a destructured argument binding */
|
||||
SCANNER_LITERAL_IS_DESTRUCTURED_ARG = SCANNER_LITERAL_IS_CONST,
|
||||
SCANNER_LITERAL_IS_USED = (1 << 6), /**< literal is used */
|
||||
SCANNER_LITERAL_EARLY_CREATE = (1 << 7), /**< binding should be created early with ECMA_VALUE_UNINITIALIZED */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
} scanner_literal_type_flags_t;
|
||||
|
||||
/*
|
||||
@@ -233,8 +215,6 @@ typedef struct
|
||||
scanner_case_info_t **last_case_p; /**< last case info */
|
||||
} scanner_switch_statement_t;
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
|
||||
/**
|
||||
* Types of scanner destructuring bindings.
|
||||
*/
|
||||
@@ -274,35 +254,27 @@ typedef struct scanner_binding_list_t
|
||||
bool is_nested; /**< is nested binding declaration */
|
||||
} scanner_binding_list_t;
|
||||
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/**
|
||||
* Flags for scanner_literal_pool_t structure.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SCANNER_LITERAL_POOL_FUNCTION = (1 << 0), /**< literal pool represents a function */
|
||||
#if JERRY_ESNEXT
|
||||
SCANNER_LITERAL_POOL_CLASS_NAME = (1 << 1), /**< literal pool which contains a class name */
|
||||
SCANNER_LITERAL_POOL_CLASS_FIELD = (1 << 2), /**< literal pool is created for a class field initializer */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
SCANNER_LITERAL_POOL_IS_STRICT = (1 << 3), /**< literal pool represents a strict mode code block */
|
||||
SCANNER_LITERAL_POOL_CAN_EVAL = (1 << 4), /**< prepare for executing eval in this block */
|
||||
SCANNER_LITERAL_POOL_NO_ARGUMENTS = (1 << 5), /**< arguments object must not be constructed,
|
||||
* or arguments cannot be stored in registers if
|
||||
* SCANNER_LITERAL_POOL_ARGUMENTS_IN_ARGS is set */
|
||||
#if JERRY_ESNEXT
|
||||
SCANNER_LITERAL_POOL_ARGUMENTS_IN_ARGS = (1 << 6), /**< arguments is referenced in function args */
|
||||
SCANNER_LITERAL_POOL_HAS_COMPLEX_ARGUMENT = (1 << 7), /**< function has complex (ES2015+) argument definition */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
SCANNER_LITERAL_POOL_IN_WITH = (1 << 8), /**< literal pool is in a with statement */
|
||||
#if JERRY_ESNEXT
|
||||
SCANNER_LITERAL_POOL_ARROW = (1 << 9), /**< arrow function */
|
||||
SCANNER_LITERAL_POOL_GENERATOR = (1 << 10), /**< generator function */
|
||||
SCANNER_LITERAL_POOL_ASYNC = (1 << 11), /**< async function */
|
||||
SCANNER_LITERAL_POOL_FUNCTION_STATEMENT = (1 << 12), /**< function statement */
|
||||
SCANNER_LITERAL_POOL_HAS_SUPER_REFERENCE = (1 << 13), /**< function body contains super reference */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
#if JERRY_MODULE_SYSTEM
|
||||
SCANNER_LITERAL_POOL_IN_EXPORT = (1 << 14), /**< the declared variables are exported by the module system */
|
||||
#endif /* JERRY_MODULE_SYSTEM */
|
||||
@@ -331,23 +303,12 @@ typedef enum
|
||||
*/
|
||||
#define SCANNER_FROM_COMPUTED_TO_LITERAL_POOL(mode) (((mode) -SCAN_STACK_COMPUTED_PROPERTY) << 10)
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
|
||||
/**
|
||||
* Literal pool which may contains function argument identifiers
|
||||
*/
|
||||
#define SCANNER_LITERAL_POOL_MAY_HAVE_ARGUMENTS(status_flags) \
|
||||
(!((status_flags) & (SCANNER_LITERAL_POOL_CLASS_NAME | SCANNER_LITERAL_POOL_CLASS_FIELD)))
|
||||
|
||||
#else /* !JERRY_ESNEXT */
|
||||
|
||||
/**
|
||||
* Literal pool which may contains function argument identifiers
|
||||
*/
|
||||
#define SCANNER_LITERAL_POOL_MAY_HAVE_ARGUMENTS(status_flags) true
|
||||
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/**
|
||||
* Local literal pool.
|
||||
*/
|
||||
@@ -367,27 +328,19 @@ struct scanner_context_t
|
||||
{
|
||||
uint32_t context_status_flags; /**< original status flags of the context */
|
||||
uint8_t mode; /**< scanner mode */
|
||||
#if JERRY_ESNEXT
|
||||
uint8_t binding_type; /**< current destructuring binding type */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
uint16_t status_flags; /**< scanner status flags */
|
||||
#if JERRY_ESNEXT
|
||||
scanner_binding_list_t *active_binding_list_p; /**< currently active binding list */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
scanner_literal_pool_t *active_literal_pool_p; /**< currently active literal pool */
|
||||
scanner_switch_statement_t active_switch_statement; /**< currently active switch statement */
|
||||
scanner_info_t *end_arguments_p; /**< position of end arguments */
|
||||
#if JERRY_ESNEXT
|
||||
const uint8_t *async_source_p; /**< source position for async functions */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
};
|
||||
|
||||
/* Scanner utils. */
|
||||
|
||||
void scanner_raise_error (parser_context_t *context_p);
|
||||
#if JERRY_ESNEXT
|
||||
void scanner_raise_redeclaration_error (parser_context_t *context_p);
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
void *scanner_malloc (parser_context_t *context_p, size_t size);
|
||||
void scanner_free (void *ptr, size_t size);
|
||||
@@ -401,10 +354,8 @@ scanner_info_t *scanner_insert_info_before (parser_context_t *context_p,
|
||||
scanner_literal_pool_t *
|
||||
scanner_push_literal_pool (parser_context_t *context_p, scanner_context_t *scanner_context_p, uint16_t status_flags);
|
||||
void scanner_pop_literal_pool (parser_context_t *context_p, scanner_context_t *scanner_context_p);
|
||||
#if JERRY_ESNEXT
|
||||
void scanner_filter_arguments (parser_context_t *context_p, scanner_context_t *scanner_context_p);
|
||||
void scanner_construct_global_block (parser_context_t *context_p, scanner_context_t *scanner_context_p);
|
||||
#endif /* JERRY_ESNEXT */
|
||||
lexer_lit_location_t *scanner_add_custom_literal (parser_context_t *context_p,
|
||||
scanner_literal_pool_t *literal_pool_p,
|
||||
const lexer_lit_location_t *literal_location_p);
|
||||
@@ -412,15 +363,12 @@ lexer_lit_location_t *scanner_add_literal (parser_context_t *context_p, scanner_
|
||||
void scanner_add_reference (parser_context_t *context_p, scanner_context_t *scanner_context_p);
|
||||
lexer_lit_location_t *scanner_append_argument (parser_context_t *context_p, scanner_context_t *scanner_context_p);
|
||||
void scanner_add_private_identifier (parser_context_t *context_p, scanner_private_field_flags_t opts);
|
||||
#if JERRY_ESNEXT
|
||||
void scanner_detect_invalid_var (parser_context_t *context_p,
|
||||
scanner_context_t *scanner_context_p,
|
||||
lexer_lit_location_t *var_literal_p);
|
||||
void scanner_detect_invalid_let (parser_context_t *context_p, lexer_lit_location_t *let_literal_p);
|
||||
#endif /* JERRY_ESNEXT */
|
||||
void scanner_detect_eval_call (parser_context_t *context_p, scanner_context_t *scanner_context_p);
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
lexer_lit_location_t *
|
||||
scanner_push_class_declaration (parser_context_t *context_p, scanner_context_t *scanner_context_p, uint8_t stack_mode);
|
||||
void scanner_push_class_field_initializer (parser_context_t *context_p, scanner_context_t *scanner_context_p);
|
||||
@@ -430,11 +378,9 @@ void scanner_push_destructuring_pattern (parser_context_t *context_p,
|
||||
bool is_nested);
|
||||
void scanner_pop_binding_list (scanner_context_t *scanner_context_p);
|
||||
void scanner_append_hole (parser_context_t *context_p, scanner_context_t *scanner_context_p);
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/* Scanner operations. */
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
void scanner_add_async_literal (parser_context_t *context_p, scanner_context_t *scanner_context_p);
|
||||
void scanner_check_arrow (parser_context_t *context_p, scanner_context_t *scanner_context_p);
|
||||
void
|
||||
@@ -442,7 +388,6 @@ scanner_scan_simple_arrow (parser_context_t *context_p, scanner_context_t *scann
|
||||
void scanner_check_arrow_arg (parser_context_t *context_p, scanner_context_t *scanner_context_p);
|
||||
bool scanner_check_async_function (parser_context_t *context_p, scanner_context_t *scanner_context_p);
|
||||
void scanner_check_function_after_if (parser_context_t *context_p, scanner_context_t *scanner_context_p);
|
||||
#endif /* JERRY_ESNEXT */
|
||||
#if JERRY_MODULE_SYSTEM
|
||||
void scanner_check_import_meta (parser_context_t *context_p);
|
||||
#endif /* JERRY_MODULE_SYSTEM */
|
||||
|
||||
Reference in New Issue
Block a user