Skip to content

[Buffer + ES6] Lose the child's class method when extending Buffer in ES6 class style #3739

@hashedhyphen

Description

@hashedhyphen

This issue is related to #2882 .

I'm now using a nightly version.

>node -v
v5.0.1-nightly201510294e54dbec51

As @trevnorris commented on 25 Sep, a following code doesn't work well now.

'use strict';

class Child extends Buffer {
  constructor(n) {
    super(n);
  }

  foo() {
    console.log('gotcha!');
  }
}

let child = new Child(4);
child.foo();  //=> TypeError: child.foo is not a function

I'm not sure how difficult is this problem to fix, but I would be happy if the above code works...

Thanks! :)

Metadata

Metadata

Assignees

Labels

bufferIssues and PRs related to the buffer subsystem.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions