Add support for new.target (#3469)
Notable changes:
* Extracted the pure JS/builtin and external C method invocations
into two new methods (`ecma_op_function_call_{simple, external}`).
* Updated parser/scanner to handle "new.target" correctly.
* Added JS test case.
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
be8ae3aae8
commit
0fd1ed6f27
@@ -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;
|
||||
|
||||
/**
|
||||
|
||||
@@ -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 */
|
||||
|
||||
/**
|
||||
@@ -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 ();
|
||||
|
||||
Reference in New Issue
Block a user