Skip to content

Commit adf1ebb

Browse files
committed
Remove workaround in node port for obtaining the callback argument size.
1 parent 22fa4bd commit adf1ebb

File tree

1 file changed

+0
-26
lines changed

1 file changed

+0
-26
lines changed

source/ports/node_port/source/node_port.cpp

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -514,8 +514,6 @@ void * metacall_node_napi_to_value(/*loader_impl_node node_impl,*/ napi_env env,
514514
{
515515
void * f = metacall_function("__metacall_node_callback_value_to_napi__");
516516
metacall_node_callback_closure closure = static_cast<metacall_node_callback_closure>(malloc(sizeof(struct metacall_node_callback_closure_type)));
517-
napi_value length;
518-
uint32_t argc;
519517

520518
closure->env = env;
521519

@@ -529,18 +527,6 @@ void * metacall_node_napi_to_value(/*loader_impl_node node_impl,*/ napi_env env,
529527

530528
metacall_node_exception(env, status);
531529

532-
// Get number of arguments to the callback (this workaround should be reviewed)
533-
status = napi_get_named_property(env, v, "length", &length);
534-
535-
metacall_node_exception(env, status);
536-
537-
status = napi_get_value_uint32(env, length, &argc);
538-
539-
metacall_node_exception(env, status);
540-
541-
// Workaround for accepting variable arguments
542-
metacall_function_resize(f, (size_t)argc);
543-
544530
return metacall_value_create_function_closure(f, (void *)closure);
545531
}
546532
else if (valuetype == napi_external)
@@ -711,21 +697,9 @@ napi_value metacall_node_value_to_napi(/* loader_impl_node node_impl,*/ napi_env
711697
{
712698
void * f = metacall_value_to_function(arg_value);
713699

714-
size_t length = metacall_function_size(f);
715-
716-
napi_value length_v;
717-
718700
status = napi_create_function(env, NULL, 0, metacall_node_callback_napi_to_value, f, &v);
719701

720702
metacall_node_exception(env, status);
721-
722-
status = napi_create_uint32(env, static_cast<uint32_t>(length), &length_v);
723-
724-
metacall_node_exception(env, status);
725-
726-
status = napi_set_named_property(env, v, "length", length_v);
727-
728-
metacall_node_exception(env, status);
729703
}
730704
else if (id == METACALL_NULL)
731705
{

0 commit comments

Comments
 (0)