Skip to content

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

Closed
@srawlins

Description

@srawlins

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";
}

Metadata

Metadata

Assignees

Labels

P2A bug or feature request we're likely to work ontype-tech-debtIssues that slow or block desirable development paths for Dartdoc, or create such problems for users

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions