Skip to content

Improve logic of calculating a "fully qualified name" #3836

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 2 commits into from
Aug 19, 2024

Conversation

srawlins
Copy link
Member

For improvements that I'm working on in another CL, it made sense to tidy up this code. The _buildFullyQualifiedName function was unnecessarily recursive and complex. And then the _fullyQualifiedNameWithoutLibrary function (a) has a complex name and (b) also worked further to do undo some work done in _buildFullyQualifiedName. This CL tidies these two "fields".

  • Combine fullyQualifiedName and _buildFullyQualifiedName into one getter (removing one field).
  • Combine fullyQualifiedNameWithoutLibrary and _fullyQualifiedNameWithoutLibrary into one late final field, remove recursion, and simplify name to qualifiedName. Also mark as @visibleForOverriding. It should be private but because of the mixin hierarchy, it is declared in one file, and defined in another.
  • Improve documentation.

  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:

Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.

For improvements that I'm working on in another CL, it made sense to tidy up this code. The `_buildFullyQualifiedName` function was unnecessarily recursive and complex. And then the `_fullyQualifiedNameWithoutLibrary` function (a) has a complex name and (b) also worked _further_ to do undo some work done in `_buildFullyQualifiedName`. This CL tidies these two "fields".

* Combine `fullyQualifiedName` and `_buildFullyQualifiedName` into one getter
  (removing one field).
* Combine `fullyQualifiedNameWithoutLibrary` and
  `_fullyQualifiedNameWithoutLibrary` into one late final field, remove
  recursion, and simplify name to `qualifiedName`. Also mark as
  `@visibleForOverriding`. It should be private but because of the mixin
  hierarchy, it is declared in one file, and defined in another.
* Improve documentation.
@srawlins
Copy link
Member Author

CC @dart-lang/analyzer-team

@srawlins srawlins merged commit 0577ca1 into dart-lang:main Aug 19, 2024
9 checks passed
@srawlins srawlins deleted the improve-qualified-name branch August 19, 2024 19:59
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