Skip to content

Several more fields on ModelElement should be eagerly computed #3244

Open
@srawlins

Description

@srawlins

In PackageGraph._precacheLocalDocs, we iterate over _allModelElements and ask each element:

  • .isCanonical, then, if true,
  • .canonicalModelElement == null , then, if true,
  • .enclosingElement!.isCanonical.

ModelElement.isCanonical calls:

  • .isPublic,
  • .canonicalLibrary, and more.

ModelElement.isPublic will check for some non-public validations (name is not empty, in a public library, enclosing element is public), and if we pass all of those, we get to !hasNodoc, which requires parsing the doc comment.

So many of these data should be calculated eagerly, as a ModelElement is being constructed. In particular, isPublic and isCanonical. For public elements, this means calculating hasNodoc eagerly, but we probably still want to avoid parsing doc comments on non-public elements.

Doing all of this eagerly should turn some late final fields into final and simplify the code.

Similar to #2970, in that we may compress the doc comment parsing in the process.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requesttype-code-healthInternal changes to our tools and workflows to make them cleaner, simpler, or more maintainabletype-performanceIssues related to slow dartdoc generation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions