Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend ExplorationMutator to explore super accesses #387

Open
saelo opened this issue Feb 1, 2023 · 0 comments
Open

Extend ExplorationMutator to explore super accesses #387

saelo opened this issue Feb 1, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@saelo
Copy link
Collaborator

saelo commented Feb 1, 2023

The ExplorationMutator could be extended to also be able to explore super in e.g. class definitions. This would likely require a new ExploreSuper operation which then looks at the prototype chain of this in contexts where super is valid. The following code shows how runtime introspection could be performed for the super binding:

class B {
  a = 42;
  get c() {
    return this.b + 1;
  }
}

class C extends B {
  b = 43;
  get c() {
    return "foo"
  }
  m() {
    console.log(Object.getOwnPropertyNames(this.__proto__.__proto__));
    // The following two are identical.
    return Reflect.get(this.__proto__.__proto__, 'c', this);
    return super.c;
  }

}

let o = new C;
console.log(o.m());
@saelo saelo added the enhancement New feature or request label Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant