Allow the JS objects to have more than one native pointer data (#2814)
Currently JS objects can only have one native pointer data which could be a limitation in special cases. This patch allows to register multiple native infos, which can be accessed/associated with the corresponding `jerry_object_native_info_t`. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
committed by
László Langó
parent
c818930cdc
commit
b3f4aa6816
@@ -455,12 +455,11 @@ jerryx_arg_transform_native_pointer (jerryx_arg_js_iterator_t *js_arg_iter_p, /*
|
||||
}
|
||||
|
||||
const jerry_object_native_info_t *expected_info_p;
|
||||
const jerry_object_native_info_t *out_info_p;
|
||||
expected_info_p = (const jerry_object_native_info_t *) c_arg_p->extra_info;
|
||||
void **ptr_p = (void **) c_arg_p->dest;
|
||||
bool is_ok = jerry_get_object_native_pointer (js_arg, ptr_p, &out_info_p);
|
||||
bool is_ok = jerry_get_object_native_pointer (js_arg, ptr_p, expected_info_p);
|
||||
|
||||
if (!is_ok || out_info_p != expected_info_p)
|
||||
if (!is_ok)
|
||||
{
|
||||
return jerry_create_error (JERRY_ERROR_TYPE,
|
||||
(jerry_char_t *) "The object has no native pointer or type does not match.");
|
||||
|
||||
Reference in New Issue
Block a user