Skip to content

Default class super points to Function in loose mode #7683

@jridgewell

Description

@jridgewell
class Test {
  constructor() {
    return super.constructor;
  }
  
  static test() {
    return super.constructor;
  }
}

console.assert(new Test() === Object, 'instance');
console.assert(Test.test() === Function, 'static');

By default, the super of an class instance is the %ObjectPrototype%. The super inside a static method though, is %FunctionPrototype% .

In loose mode, we transform this directly into Function.prototype (really wrong) and Function (spec-y wrong).

repl

Metadata

Metadata

Assignees

No one assigned

    Labels

    PR: Spec Compliance 👓A type of pull request used for our changelog categoriesSpec: ClassesoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions