Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions jerry-core/ecma/base/ecma-globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ typedef enum
ECMA_PARSE_HAS_STATIC_SUPER = (1u << 5), /**< the current context is a static class method */
ECMA_PARSE_EVAL = (1u << 6), /**< eval is called */
ECMA_PARSE_MODULE = (1u << 7), /**< module is parsed */
ECMA_PARSE_FUNCTION = (1u << 8), /**< a function body is parsed or the code is inside a function */
} ecma_parse_opts_t;

/**
Expand Down
8 changes: 8 additions & 0 deletions jerry-core/ecma/base/ecma-init-finalize.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ ecma_init (void)
#if ENABLED (JERRY_ES2015_BUILTIN_PROMISE)
ecma_job_queue_init ();
#endif /* ENABLED (JERRY_ES2015_BUILTIN_PROMISE) */

#if ENABLED (JERRY_ES2015)
JERRY_CONTEXT (current_new_target) = JERRY_CONTEXT_INVALID_NEW_TARGET;
#endif /* ENABLED (JERRY_ES2015) */
} /* ecma_init */

/**
Expand All @@ -62,6 +66,10 @@ ecma_init (void)
void
ecma_finalize (void)
{
#if ENABLED (JERRY_ES2015)
JERRY_ASSERT (JERRY_CONTEXT (current_new_target) == JERRY_CONTEXT_INVALID_NEW_TARGET);
#endif /* ENABLED (JERRY_ES2015) */

ecma_finalize_global_lex_env ();
ecma_finalize_builtins ();
ecma_gc_run ();
Expand Down
6 changes: 6 additions & 0 deletions jerry-core/ecma/operations/ecma-eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ ecma_op_eval_chars_buffer (const lit_utf8_byte_t *code_p, /**< code characters b

#if ENABLED (JERRY_ES2015)
ECMA_CLEAR_SUPER_EVAL_PARSER_OPTS ();

/* If an eval is used inside the function the info should be propagated. */
if (JERRY_CONTEXT (current_new_target) != JERRY_CONTEXT_INVALID_NEW_TARGET)
{
parse_opts |= ECMA_PARSE_FUNCTION;
}
#endif /* ENABLED (JERRY_ES2015) */

ecma_value_t parse_status = parser_parse_script (NULL,
Expand Down
Loading