@@ -576,6 +576,7 @@ class Class extends ModelElement
576576
577577 Class (ClassElement element, Library library, PackageGraph packageGraph)
578578 : super (element, library, packageGraph, null ) {
579+ packageGraph.specialClasses.addSpecial (this );
579580 _mixins = _cls.mixins
580581 .map ((f) {
581582 DefinedElementType t = new ElementType .from (f, packageGraph);
@@ -2536,22 +2537,24 @@ class Library extends ModelElement with Categorization, TopLevelContainer {
25362537 if (_modelElementsMap == null ) {
25372538 final Set <ModelElement > results = new Set ();
25382539 results
2539- ..addAll (library.allClasses)
25402540 ..addAll (library.constants)
2541- ..addAll (library.enums)
25422541 ..addAll (library.functions)
2543- ..addAll (library.mixins)
25442542 ..addAll (library.properties)
25452543 ..addAll (library.typedefs);
25462544
25472545 library.allClasses.forEach ((c) {
2548- results.addAll (c.allModelElements);
25492546 results.add (c);
2547+ results.addAll (c.allModelElements);
25502548 });
25512549
25522550 library.enums.forEach ((e) {
2553- results.addAll (e.allModelElements);
25542551 results.add (e);
2552+ results.addAll (e.allModelElements);
2553+ });
2554+
2555+ library.mixins.forEach ((m) {
2556+ results.add (m);
2557+ results.addAll (m.allModelElements);
25552558 });
25562559
25572560 _modelElementsMap = new Map <Element , Set <ModelElement >>();
@@ -4607,14 +4610,16 @@ class PackageGraph {
46074610 findOrCreateLibraryFor (element);
46084611 });
46094612
4613+ // From here on in, we might find special objects. Initialize the
4614+ // specialClasses handler so when we find them, they get added.
4615+ specialClasses = new SpecialClasses ();
46104616 // Go through docs of every ModelElement in package to pre-build the macros
46114617 // index.
4612- allLocalModelElements .forEach ((m) => m.documentationLocal);
4618+ allModelElements .forEach ((m) => m.documentationLocal);
46134619 _localDocumentationBuilt = true ;
46144620
46154621 // Scan all model elements to insure that interceptor and other special
46164622 // objects are found.
4617- specialClasses = new SpecialClasses (this );
46184623 // After the allModelElements traversal to be sure that all packages
46194624 // are picked up.
46204625 documentedPackages.toList ().forEach ((package) {
@@ -4625,6 +4630,9 @@ class PackageGraph {
46254630 });
46264631 _implementors.values.forEach ((l) => l.sort ());
46274632 allImplementorsAdded = true ;
4633+
4634+ // We should have found all special classes by now.
4635+ specialClasses.assertSpecials ();
46284636 }
46294637
46304638 SpecialClasses specialClasses;
@@ -5345,6 +5353,32 @@ class PackageGraph {
53455353 return foundLibrary;
53465354 }
53475355
5356+ List <ModelElement > _allModelElements;
5357+ Iterable <ModelElement > get allModelElements {
5358+ assert (allLibrariesAdded);
5359+ if (_allModelElements == null ) {
5360+ _allModelElements = [];
5361+ Set <Package > packagesToDo = packages.toSet ();
5362+ Set <Package > completedPackages = new Set ();
5363+ while (packagesToDo.length > completedPackages.length) {
5364+ packagesToDo.difference (completedPackages).forEach ((Package p) {
5365+ Set <Library > librariesToDo = p.allLibraries.toSet ();
5366+ Set <Library > completedLibraries = new Set ();
5367+ while (librariesToDo.length > completedLibraries.length) {
5368+ librariesToDo.difference (completedLibraries).forEach ((Library library) {
5369+ _allModelElements.addAll (library.allModelElements);
5370+ completedLibraries.add (library);
5371+ });
5372+ librariesToDo.addAll (p.allLibraries);
5373+ }
5374+ completedPackages.add (p);
5375+ });
5376+ packagesToDo.addAll (packages);
5377+ }
5378+ }
5379+ return _allModelElements;
5380+ }
5381+
53485382 List <ModelElement > _allLocalModelElements;
53495383 Iterable <ModelElement > get allLocalModelElements {
53505384 assert (allLibrariesAdded);
@@ -5817,14 +5851,21 @@ class Package extends LibraryContainer
58175851 bool get isLocal => _isLocal;
58185852
58195853 DocumentLocation get documentedWhere {
5820- if (! isLocal) {
5821- if (config.linkToRemote && config.linkToUrl.isNotEmpty) {
5854+ if (isLocal) {
5855+ if (isPublic) {
5856+ return DocumentLocation .local;
5857+ } else {
5858+ // Possible if excludes result in a "documented" package not having
5859+ // any actual documentation.
5860+ return DocumentLocation .missing;
5861+ }
5862+ } else {
5863+ if (config.linkToRemote && config.linkToUrl.isNotEmpty && isPublic) {
58225864 return DocumentLocation .remote;
58235865 } else {
58245866 return DocumentLocation .missing;
58255867 }
58265868 }
5827- return DocumentLocation .local;
58285869 }
58295870
58305871 @override
0 commit comments