Remove JERRY_CONTEXT_INVALID_NEW_TARGET (#3643)
Until now JERRY_CONTEXT_INVALID_NEW_TARGET was used to represent whether the eval called from the script directly. This information can be retrieved from the parser, so it simplifies the runtime handling of the new.target. This patch fixes #3630, fixes #3640 and fixes #3641. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
@@ -111,13 +111,13 @@ typedef enum
|
||||
ECMA_PARSE_EVAL = (1u << 2), /**< eval is called */
|
||||
ECMA_PARSE_DIRECT_EVAL = (1u << 3), /**< eval is called directly (ECMA-262 v5, 15.1.2.1.1) */
|
||||
|
||||
/* These three status flags must be in this order. See PARSER_SAVED_FLAGS_OFFSET. */
|
||||
/* These 4 status flags must be in this order. See PARSER_SAVED_FLAGS_OFFSET. */
|
||||
ECMA_PARSE_CLASS_CONSTRUCTOR = (1u << 4), /**< a class constructor is being parsed (this value must be kept in
|
||||
* in sync with PARSER_CLASS_CONSTRUCTOR) */
|
||||
ECMA_PARSE_ALLOW_SUPER = (1u << 5), /**< allow super property access */
|
||||
ECMA_PARSE_ALLOW_SUPER_CALL = (1u << 6), /**< allow super constructor call */
|
||||
ECMA_PARSE_ALLOW_NEW_TARGET = (1u << 7), /**< allow new.target access */
|
||||
|
||||
ECMA_PARSE_CALLED_FROM_FUNCTION = (1u << 7), /**< a function body is parsed or the code is inside a function */
|
||||
ECMA_PARSE_GENERATOR_FUNCTION = (1u << 8), /**< generator function is parsed */
|
||||
|
||||
/* These flags are internally used by the parser. */
|
||||
|
||||
@@ -61,7 +61,7 @@ ecma_init (void)
|
||||
#endif /* ENABLED (JERRY_ES2015_BUILTIN_PROMISE) */
|
||||
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
JERRY_CONTEXT (current_new_target) = JERRY_CONTEXT_INVALID_NEW_TARGET;
|
||||
JERRY_CONTEXT (current_new_target) = NULL;
|
||||
JERRY_CONTEXT (current_function_obj_p) = NULL;
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
} /* ecma_init */
|
||||
@@ -73,7 +73,7 @@ void
|
||||
ecma_finalize (void)
|
||||
{
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
JERRY_ASSERT (JERRY_CONTEXT (current_new_target) == JERRY_CONTEXT_INVALID_NEW_TARGET);
|
||||
JERRY_ASSERT (JERRY_CONTEXT (current_new_target) == NULL);
|
||||
JERRY_ASSERT (JERRY_CONTEXT (current_function_obj_p) == NULL);
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user