Rework function call. (#2414)

Furthermore add a construct flag, which disallows calling certain
functions without new. Constructing bound arrow functions correctly
throws error now.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2018-07-11 02:35:44 +02:00
committed by yichoi
parent 50daa39ee8
commit 04dcefe087
4 changed files with 313 additions and 225 deletions
@@ -204,6 +204,22 @@ ecma_builtin_get (ecma_builtin_id_t builtin_id) /**< id of built-in to check on
return JERRY_CONTEXT (ecma_builtin_objects)[builtin_id];
} /* ecma_builtin_get */
/**
* Get reference to the global object
*
* Note:
* Does not increase the reference counter.
*
* @return pointer to the global object
*/
inline ecma_object_t * JERRY_ATTR_ALWAYS_INLINE
ecma_builtin_get_global (void)
{
JERRY_ASSERT (JERRY_CONTEXT (ecma_builtin_objects)[ECMA_BUILTIN_ID_GLOBAL] != NULL);
return JERRY_CONTEXT (ecma_builtin_objects)[ECMA_BUILTIN_ID_GLOBAL];
} /* ecma_builtin_get_global */
/**
* Checks whether the given function is a built-in routine
*
@@ -96,6 +96,8 @@ bool
ecma_builtin_is (ecma_object_t *obj_p, ecma_builtin_id_t builtin_id);
ecma_object_t *
ecma_builtin_get (ecma_builtin_id_t builtin_id);
ecma_object_t *
ecma_builtin_get_global (void);
bool
ecma_builtin_function_is_routine (ecma_object_t *func_obj_p);