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

JS: Make getInstance() propagate to subclasses #16136

Merged
merged 4 commits into from
Apr 8, 2024

Conversation

asgerf
Copy link
Contributor

@asgerf asgerf commented Apr 5, 2024

This makes the Instance MaD token obtain instances of the current class as well as instances of subclasses of the current class. For the moment this only works for sources (formerly known as use-nodes). I'll add a corresponding case for sinks (def-nodes) in a separate PR.

For example, foo;Member[C].Instance.Member[m] now matches the following:

import { C } from "foo";

new C().m(); // <-- found (same as before)

class D extends C {
  d() {
    this.m(); // <-- found (new)
}
new D().m(); // <-- found (new)

This aligns with how MaD for Ruby works, and resolves some issues that were raised in user feedback (see backlink).

@asgerf asgerf marked this pull request as ready for review April 8, 2024 08:04
@asgerf asgerf requested a review from a team as a code owner April 8, 2024 08:04
Copy link
Contributor

@erik-krogh erik-krogh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@asgerf asgerf merged commit f08e8b1 into github:main Apr 8, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants