Description
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.