Fix redeclaration related eval corner cases (#4886)
- Fix cases where a function parameter binding is redeclared inside a parameter initializer eval - Fix cases where a let- or function arguments binding is redeclared inside a function block because there is a declaration in a function parameter initializer eval - Also remove the ECMA_PARSE_CHAIN_INDEX_SHIFT macro, added a debugger_eval_chain_index named field to the jerry context instead JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
This commit is contained in:
@@ -86,18 +86,8 @@ typedef enum
|
||||
ECMA_TYPE___MAX = ECMA_TYPE_ERROR /** highest value for ecma types */
|
||||
} ecma_type_t;
|
||||
|
||||
#if JERRY_DEBUGGER
|
||||
/**
|
||||
* Shift for scope chain index part in ecma_parse_opts
|
||||
*/
|
||||
#define ECMA_PARSE_CHAIN_INDEX_SHIFT 16
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
|
||||
/**
|
||||
* Option flags for parser_parse_script and internal flags for global_status_flags in parser context.
|
||||
* Note:
|
||||
* the last 16 bits is reserved for internal parser flags, because the debugger uses these
|
||||
* 16 bits to encode the scope chain skip index as well (see ECMA_PARSE_CHAIN_INDEX_SHIFT)
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
@@ -112,30 +102,31 @@ typedef enum
|
||||
* See PARSER_SAVE_STATUS_FLAGS / PARSER_RESTORE_STATUS_FLAGS. */
|
||||
ECMA_PARSE_ALLOW_SUPER = (1u << 5), /**< allow super property access */
|
||||
ECMA_PARSE_ALLOW_SUPER_CALL = (1u << 6), /**< allow super constructor call */
|
||||
ECMA_PARSE_INSIDE_CLASS_FIELD = (1u << 7), /**< a class field is being parsed */
|
||||
ECMA_PARSE_ALLOW_NEW_TARGET = (1u << 8), /**< allow new.target access */
|
||||
ECMA_PARSE_FUNCTION_CONTEXT = (1u << 9), /**< function context is present (ECMA_PARSE_DIRECT_EVAL must be set) */
|
||||
ECMA_PARSE_FUNCTION_IS_PARSING_ARGS = (1u << 7), /**< set when parsing function arguments */
|
||||
ECMA_PARSE_INSIDE_CLASS_FIELD = (1u << 8), /**< a class field is being parsed */
|
||||
ECMA_PARSE_ALLOW_NEW_TARGET = (1u << 9), /**< allow new.target access */
|
||||
ECMA_PARSE_FUNCTION_CONTEXT = (1u << 10), /**< function context is present (ECMA_PARSE_DIRECT_EVAL must be set) */
|
||||
|
||||
ECMA_PARSE_HAS_SOURCE_VALUE = (1u << 10), /**< source_p points to a value list
|
||||
ECMA_PARSE_HAS_SOURCE_VALUE = (1u << 11), /**< source_p points to a value list
|
||||
* and the first value is the source code */
|
||||
ECMA_PARSE_HAS_ARGUMENT_LIST_VALUE = (1u << 11), /**< source_p points to a value list
|
||||
ECMA_PARSE_HAS_ARGUMENT_LIST_VALUE = (1u << 12), /**< source_p points to a value list
|
||||
* and the second value is the argument list */
|
||||
#if JERRY_ESNEXT
|
||||
ECMA_PARSE_GENERATOR_FUNCTION = (1u << 12), /**< generator function is parsed */
|
||||
ECMA_PARSE_ASYNC_FUNCTION = (1u << 13), /**< async function is parsed */
|
||||
ECMA_PARSE_GENERATOR_FUNCTION = (1u << 13), /**< generator function is parsed */
|
||||
ECMA_PARSE_ASYNC_FUNCTION = (1u << 14), /**< async function is parsed */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/* These flags are internally used by the parser. */
|
||||
ECMA_PARSE_INTERNAL_FREE_SOURCE = (1u << 14), /**< free source_p data */
|
||||
ECMA_PARSE_INTERNAL_FREE_ARG_LIST = (1u << 15), /**< free arg_list_p data */
|
||||
ECMA_PARSE_INTERNAL_FREE_SOURCE = (1u << 15), /**< free source_p data */
|
||||
ECMA_PARSE_INTERNAL_FREE_ARG_LIST = (1u << 16), /**< free arg_list_p data */
|
||||
#if JERRY_ESNEXT
|
||||
ECMA_PARSE_INTERNAL_PRE_SCANNING = (1u << 16), /**< the parser is in pre-scanning mode */
|
||||
ECMA_PARSE_INTERNAL_PRE_SCANNING = (1u << 17), /**< the parser is in pre-scanning mode */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
#if JERRY_MODULE_SYSTEM
|
||||
ECMA_PARSE_INTERNAL_HAS_IMPORT_META = (1u << 17), /**< module has import.meta expression */
|
||||
ECMA_PARSE_INTERNAL_HAS_IMPORT_META = (1u << 18), /**< module has import.meta expression */
|
||||
#endif /* JERRY_MODULE_SYSTEM */
|
||||
#if JERRY_FUNCTION_TO_STRING
|
||||
ECMA_PARSE_INTERNAL_HAS_4_BYTE_MARKER = (1u << 18), /**< source has 4 byte marker */
|
||||
ECMA_PARSE_INTERNAL_HAS_4_BYTE_MARKER = (1u << 19), /**< source has 4 byte marker */
|
||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
||||
#ifndef JERRY_NDEBUG
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user