Skip to content

Commit 04dcefe

Browse files
zherczegyichoi
authored andcommitted
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 [email protected]
1 parent 50daa39 commit 04dcefe

File tree

4 files changed

+295
-207
lines changed

4 files changed

+295
-207
lines changed

jerry-core/ecma/builtin-objects/ecma-builtins.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,22 @@ ecma_builtin_get (ecma_builtin_id_t builtin_id) /**< id of built-in to check on
204204
return JERRY_CONTEXT (ecma_builtin_objects)[builtin_id];
205205
} /* ecma_builtin_get */
206206

207+
/**
208+
* Get reference to the global object
209+
*
210+
* Note:
211+
* Does not increase the reference counter.
212+
*
213+
* @return pointer to the global object
214+
*/
215+
inline ecma_object_t * JERRY_ATTR_ALWAYS_INLINE
216+
ecma_builtin_get_global (void)
217+
{
218+
JERRY_ASSERT (JERRY_CONTEXT (ecma_builtin_objects)[ECMA_BUILTIN_ID_GLOBAL] != NULL);
219+
220+
return JERRY_CONTEXT (ecma_builtin_objects)[ECMA_BUILTIN_ID_GLOBAL];
221+
} /* ecma_builtin_get_global */
222+
207223
/**
208224
* Checks whether the given function is a built-in routine
209225
*

jerry-core/ecma/builtin-objects/ecma-builtins.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ bool
9696
ecma_builtin_is (ecma_object_t *obj_p, ecma_builtin_id_t builtin_id);
9797
ecma_object_t *
9898
ecma_builtin_get (ecma_builtin_id_t builtin_id);
99+
ecma_object_t *
100+
ecma_builtin_get_global (void);
99101
bool
100102
ecma_builtin_function_is_routine (ecma_object_t *func_obj_p);
101103

0 commit comments

Comments
 (0)