Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only first argument seen from constructor #17

Open
bahamas10 opened this issue Jul 16, 2015 · 0 comments
Open

only first argument seen from constructor #17

bahamas10 opened this issue Jul 16, 2015 · 0 comments

Comments

@bahamas10
Copy link

In a test project using the latest available v8plus on npm I have

src/node_test.c

#include "v8plus_glue.h"

static char *ident = "foo";

static nvlist_t *
node_test_ctor(const nvlist_t *ap, void **cpp)
{
        printf("constructor called\n");
        nvlist_print_json(stdout, (nvlist_t *)ap);
        printf("\n");

        *cpp = ident;

        return v8plus_void();
}

static void
node_test_dtor(void *op)
{
        op = op; // -Werror
}

static nvlist_t *
node_test_foo(void *op, const nvlist_t *ap)
{
        op = op; // -Werror
        ap = ap; // -Werror
        return v8plus_void();
}

/*
 * v8+ boilerplate
 */
const v8plus_c_ctor_f v8plus_ctor = node_test_ctor;
const v8plus_c_dtor_f v8plus_dtor = node_test_dtor;
const char *v8plus_js_factory_name = "_new";
const char *v8plus_js_class_name = "TestBinding";
const v8plus_method_descr_t v8plus_methods[] = {
        {
                md_name: "foo",
                md_c_func: node_test_foo
        }
};
const uint_t v8plus_method_count = sizeof (v8plus_methods) / sizeof (v8plus_methods[0]);

const v8plus_static_descr_t v8plus_static_methods[] = {};
const uint_t v8plus_static_method_count = 0;

and

lib/index.js

var binding = require('./test_binding');
binding._new('foo', 'bar', 'baz');

when I run lib/index.js i see

$ node lib/index.js 
constructor called
{"0":"foo"}

it appears that only the first argument is being processed for some reason

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant