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

declare_types! generate depreaction notice on node 6.2.2 #97

Closed
mcheshkov opened this issue Jul 13, 2016 · 1 comment
Closed

declare_types! generate depreaction notice on node 6.2.2 #97

mcheshkov opened this issue Jul 13, 2016 · 1 comment

Comments

@mcheshkov
Copy link

pub struct Greeter {
    greeting: String
}

declare_types! {
    pub class JsGreeter for Greeter {
        init(call) {
            Ok(Greeter {
                greeting: String::default()
            })
        }

        method hello(call) {
            Ok(JsNull::new().as_value(call.scope))
        }
    }
}

register_module!(m, {
    let scope = m.scope;
    let class = try!(JsGreeter::class(scope));
    let constructor = try!(class.constructor(scope));
    try!(m.exports.set("JsGreeter", constructor));

    Ok(())
});

Code like that gives me

$ node -p "require('./native')"
(node) v8::ObjectTemplate::Set() with non-primitive values is deprecated
(node) and will stop working in the next major release.

and stack traces.

Googling a little bit show up nodejs/node#6228 and it seems that same thing as in NODE_SET_METHOD in src/node.h need to be done in NeonSys_Class_AddMethod in neon/crates/neon-sys/src/neon.cc - Setting FunctionTemplate to prototype instead of Function.

@dherman
Copy link
Collaborator

dherman commented Sep 15, 2021

The declare_types! macro is deprecated and removed in the new backend, so I'll close this one.

@dherman dherman closed this as completed Sep 15, 2021
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

2 participants