Skip to content

class field initializers are broken in subclasses #948

@ChALkeR

Description

@ChALkeR
class A {}
class B extends A {
  b = 2
  constructor() { super() }
}
print(1)
new B() // throws, but shouldn't
print(2)

Output:

1
Uncaught exception: ReferenceError: Uninitialized this binding

Expected:

1
2

e.g. https://npmjs.com/@noble/hashes uses that

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomershelp wantedExtra attention is needed

    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