Skip to content

inheritance of C/C++ Addons doesn't work #9288

Closed
@stixx200

Description

@stixx200
  • Version: v6.9.1
  • Platform: Win7 SP1, 64-Bit
  • Subsystem:

There is an issue with the inheritance of native node addons in Node v6.9.1.
The problem doesn't exist with Node v4.6.1 or Node v7.0.0.

To reconstruct, i used the example code of Node docs (https://nodejs.org/dist/latest-v6.x/docs/api/addons.html#addons_wrapping_c_objects) and ran the code with this example:

"use strict";
const addon = require('./build/Release/addon');
class Test extends addon.MyObject {
    constructor() {
        super();
        this.doOutput();
    }
    doOutput() {
        console.log("hello world");
    }
}
var obj = new Test();

Result is:

TypeError: this.doOutput is not a function

The problem is, that the this is empty after super() call.

Metadata

Metadata

Assignees

No one assigned

    Labels

    addonsIssues and PRs related to native addons.v8 engineIssues and PRs related to the V8 dependency.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions