Closed Bug 1552022 Opened 5 years ago Closed 5 years ago

Synthesized constructors for derived classes ignore all arguments (with fields and no constructor() method)

Categories

(Core :: JavaScript Engine, task, P1)

task

Tracking

()

RESOLVED FIXED
mozilla68
Tracking Status
firefox68 --- fixed

People

(Reporter: jorendorff, Assigned: khyperia)

References

Details

Attachments

(1 file)

Ashley noticed this.

class B {
    constructor(x) {
        console.log(x);
    }
}

class C extends B {
}

new C("C"); // prints "C"

class D extends B {
    asdf = 2;
}

new D("D"); // prints undefined :'(

The synthesized constructor should do super(...args), but currently it just does super().

Priority: -- → P1
Summary: Arguments are ignored in derived-class synthesized constructors → Synthesized constructors for derived classes ignore all arguments (with fields and no constructor() method)
Pushed by ahauck@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3944c733e417 Pass through arguments in synthesized constructors for derived classes. r=jorendorff
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
Assignee: nobody → khyperia
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: