Skip to content

Refactor dartdoc's complex system of "special classes" #3927

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

Closed
srawlins opened this issue Nov 12, 2024 · 0 comments · Fixed by #3929
Closed

Refactor dartdoc's complex system of "special classes" #3927

srawlins opened this issue Nov 12, 2024 · 0 comments · Fixed by #3929
Assignees
Labels
P2 A bug or feature request we're likely to work on type-tech-debt Issues that slow or block desirable development paths for Dartdoc, or create such problems for users

Comments

@srawlins
Copy link
Member

Dartdoc has a system of "special classes" (see special_elements.dart), which are classes defined in the Dart SDK, and which are then used in a few different ways, comparing elements found while documenting with elements from the SDK. For example, "pragma" annotations are treated specially, so when we find an annotated element, we compare each annotation to "pragma".

Instead of taking the strategy that analyzer takes, Dartdoc's SpecialClass and SpecialClasses types hold on to references of the actual special types found in the SDK (like Object and pragma). There is little or no gain to this complex system; we can instead implement predicates like the analyzer has:

class ClassElement {
  bool get isDartCoreObject => name == 'Object' && library.isDartCore;
}

class LibraryElement {
  bool get isDartCore => name == "dart.core";
}
@srawlins srawlins added P2 A bug or feature request we're likely to work on type-tech-debt Issues that slow or block desirable development paths for Dartdoc, or create such problems for users labels Nov 12, 2024
@srawlins srawlins self-assigned this Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 A bug or feature request we're likely to work on type-tech-debt Issues that slow or block desirable development paths for Dartdoc, or create such problems for users
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant