Rework external function handlers (#4599)

Instead of a fixed number of arguments, a call info structure is passed
to the handlers, which can be extended in the future without breaknig the
API. This structure holds new.target value, so its getter function is removed.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2021-02-17 17:52:19 +01:00
committed by GitHub
parent 488a0bf7e8
commit 112ad83aaa
51 changed files with 322 additions and 586 deletions
+13 -2
View File
@@ -296,11 +296,15 @@ enum
*/
typedef ecma_value_t (*ecma_vm_exec_stop_callback_t) (void *user_p);
/**
* Forward definition of jerry_call_info_t.
*/
struct jerry_call_info_t;
/**
* Type of an external function handler.
*/
typedef ecma_value_t (*ecma_native_handler_t) (const ecma_value_t function_obj,
const ecma_value_t this_val,
typedef ecma_value_t (*ecma_native_handler_t) (const struct jerry_call_info_t *call_info_p,
const ecma_value_t args_p[],
const uint32_t args_count);
@@ -881,6 +885,13 @@ typedef struct
#endif /* JERRY_BUILTIN_REALMS */
} ecma_built_in_props_t;
/**
* Type of a built-in function handler.
*/
typedef ecma_value_t (*ecma_builtin_handler_t) (ecma_object_t *function_obj_p,
const ecma_value_t args_p[],
const uint32_t args_count);
#if JERRY_BUILTIN_REALMS
/**