Skip to content

declare_types! generate depreaction notice on node 6.2.2 #97

@mcheshkov

Description

@mcheshkov
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions