Skip to content

Refactor ModelElement.element to be a getter; subclasses provide the field #3217

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

Merged
merged 3 commits into from
Oct 24, 2022

Conversation

srawlins
Copy link
Member

I think this is the more correct layout for ModelElement and its subclasses. Code in ModelElement (and outside its subclasses) just needs to know about the Element. Subclasses define the backing field with Element subtypes. This does not seem to have grand performance characteristics, but should result in simpler code, fewer casts, and fewer parameters in super calls.

@srawlins srawlins requested a review from keertip October 18, 2022 15:16
Copy link
Collaborator

@keertip keertip left a comment

Choose a reason for hiding this comment

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

Totally makes sense! Nice!

@srawlins srawlins merged commit 51464a3 into dart-lang:master Oct 24, 2022
@srawlins srawlins deleted the element-is-getter branch October 24, 2022 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants