Improve new.target handling in case of eval calls (#3517)
Only direct eval calls propagate the "new.target" information. In any other eval cases the "new.target" invocation is a syntax error. Added test cases also. JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
This commit is contained in:
committed by
Robert Fancsik
parent
05b4bda927
commit
608bc9e5ff
@@ -100,8 +100,9 @@ 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)
|
||||
/* If a direct eval is used inside the function the info should be propagated. */
|
||||
if (JERRY_CONTEXT (current_new_target) != JERRY_CONTEXT_INVALID_NEW_TARGET
|
||||
&& (JERRY_CONTEXT (status_flags) & ECMA_STATUS_DIRECT_EVAL))
|
||||
{
|
||||
parse_opts |= ECMA_PARSE_FUNCTION;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user