initializePackageGraph method

Future<void> initializePackageGraph()

Call after all libraries are added.

Implementation

Future<void> initializePackageGraph() async {
  allLibrariesAdded = true;
  assert(!_localDocumentationBuilt);
  // From here on in, we might find special objects.  Initialize the
  // specialClasses handler so when we find them, they get added.
  specialClasses = SpecialClasses();
  // Go through docs of every ModelElement in package to pre-build the macros
  // index.
  await Future.wait(precacheLocalDocs());
  _localDocumentationBuilt = true;

  // Scan all model elements to insure that interceptor and other special
  // objects are found.
  // Emit warnings for any local package that has no libraries.
  // After the allModelElements traversal to be sure that all packages
  // are picked up.
  for (var package in documentedPackages) {
    for (var library in package.libraries) {
      _addToImplementors(library.allClasses);
      _addToImplementors(library.mixins);
      _extensions.addAll(library.extensions);
    }
    if (package.isLocal && !package.hasPublicLibraries) {
      package.warn(PackageWarning.noDocumentableLibrariesInPackage);
    }
  }
  allImplementorsAdded = true;
  allExtensionsAdded = true;

  // We should have found all special classes by now.
  specialClasses.assertSpecials();
}