-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Closed
Labels
duplicateIssues and PRs that are duplicates of other issues or PRs.Issues and PRs that are duplicates of other issues or PRs.v8 engineIssues and PRs related to the V8 dependency.Issues and PRs related to the V8 dependency.
Description
- Version: v6.9.1
- Platform: macOS (Darwin)
- Subsystem: v8
A native v8 class is extended on the JavaScript side and new methods are added. However, those methods cannot be called in the newly created instance: they are undefined. Something seems to be wrong with the prototype chain. It also fails if the older prototyping syntax is being used.
The issue is reproducible on Node.js v.6.9.1. Node v4.x and v7.0.0 are not affected.
Sample code:
https://github.com/cbratschi/aminogfx-gl/blob/master/demos/tests/js.js
/**
* Extend AminoGfx Class.
*/
class Circle extends Polygon {
constructor(amino) {
super(amino);
console.log('Circle: constructor');
/*
* Issues:
*
* - Node v6.9.1
* - TypeError: this.setup is not a function
*
* Works fine:
*
* - Node v4.x
* - Node v7.0.0
*/
this.setup();
}
setup() {
console.log('Circle.setup()');
}
}Polygon is the native class.
Metadata
Metadata
Assignees
Labels
duplicateIssues and PRs that are duplicates of other issues or PRs.Issues and PRs that are duplicates of other issues or PRs.v8 engineIssues and PRs related to the V8 dependency.Issues and PRs related to the V8 dependency.