Skip to content

Commit c8dd09c

Browse files
authored
More cleanup from removal of SpecialClasses (#3955)
1 parent b082872 commit c8dd09c

File tree

2 files changed

+29
-41
lines changed

2 files changed

+29
-41
lines changed

lib/src/model/package_builder.dart

+29-40
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,9 @@ class PubPackageBuilder implements PackageBuilder {
226226
/// [addingSpecials] indicates that only [SpecialClass]es are being resolved
227227
/// in this round.
228228
Future<void> _discoverLibraries(
229-
void Function(DartDocResolvedLibrary) addLibrary,
230-
Set<LibraryElement> processedLibraries,
231-
Set<String> files, {
232-
bool addingSpecials = false,
233-
}) async {
229+
void Function(DartDocResolvedLibrary) addLibrary,
230+
Set<LibraryElement> processedLibraries,
231+
Set<String> files) async {
234232
files = {...files};
235233
// Discover Dart libraries in a loop. In each iteration of the loop, we take
236234
// a set of files (starting with the ones passed into the function), resolve
@@ -251,17 +249,15 @@ class PubPackageBuilder implements PackageBuilder {
251249
// find all documentable files in that package, for the universal reference
252250
// scope. This variable tracks which packages we've seen so far.
253251
var knownPackages = <PackageMeta>{};
254-
if (!addingSpecials) {
255-
progressBarStart(files.length);
256-
}
252+
progressBarStart(files.length);
253+
257254
// The set of files that are discovered while iterating in the below
258255
// do-while loop, which are then added to `files`, as they are found.
259256
var newFiles = <String>{};
260257
do {
261258
filesInLastPass = filesInCurrentPass;
262-
if (!addingSpecials) {
263-
progressBarUpdateTickCount(files.length);
264-
}
259+
progressBarUpdateTickCount(files.length);
260+
265261
// Be careful here, not to accidentally stack up multiple
266262
// [DartDocResolvedLibrary]s, as those eat our heap.
267263
var libraryFiles = files.difference(_knownParts);
@@ -271,9 +267,8 @@ class PubPackageBuilder implements PackageBuilder {
271267
continue;
272268
}
273269
processedFiles.add(file);
274-
if (!addingSpecials) {
275-
progressBarTick();
276-
}
270+
progressBarTick();
271+
277272
var resolvedLibrary = await _resolveLibrary(file);
278273
if (resolvedLibrary == null) {
279274
// `file` did not resolve to a _library_; could be a part, an
@@ -292,41 +287,35 @@ class PubPackageBuilder implements PackageBuilder {
292287
processedLibraries.add(resolvedLibrary.element);
293288
}
294289
files.addAll(newFiles);
295-
if (!addingSpecials) {
296-
var externals = _includedExternalsFrom(newFiles);
297-
if (externals.isNotEmpty) {
298-
includeExternalsWasSpecified = true;
299-
}
300-
files.addAll(externals);
290+
var externals = _includedExternalsFrom(newFiles);
291+
if (externals.isNotEmpty) {
292+
includeExternalsWasSpecified = true;
301293
}
294+
files.addAll(externals);
302295

303296
var packages = _packageMetasForFiles(files.difference(_knownParts));
304297
filesInCurrentPass = {...files.difference(_knownParts)};
305298

306-
if (!addingSpecials) {
307-
// To get canonicalization correct for non-locally documented packages
308-
// (so we can generate the right hyperlinks), it's vital that we add all
309-
// libraries in dependent packages. So if the analyzer discovers some
310-
// files in a package we haven't seen yet, add files for that package.
311-
for (var meta in packages.difference(knownPackages)) {
312-
if (meta.isSdk) {
313-
if (!_skipUnreachableSdkLibraries) {
314-
files.addAll(_sdkFilesToDocument);
315-
}
316-
} else {
317-
files.addAll(await _findFilesToDocumentInPackage(
318-
meta.dir.path,
319-
includeDependencies: false,
320-
filterExcludes: false,
321-
).toList());
299+
// To get canonicalization correct for non-locally documented packages
300+
// (so we can generate the right hyperlinks), it's vital that we add all
301+
// libraries in dependent packages. So if the analyzer discovers some
302+
// files in a package we haven't seen yet, add files for that package.
303+
for (var meta in packages.difference(knownPackages)) {
304+
if (meta.isSdk) {
305+
if (!_skipUnreachableSdkLibraries) {
306+
files.addAll(_sdkFilesToDocument);
322307
}
308+
} else {
309+
files.addAll(await _findFilesToDocumentInPackage(
310+
meta.dir.path,
311+
includeDependencies: false,
312+
filterExcludes: false,
313+
).toList());
323314
}
324-
knownPackages.addAll(packages);
325315
}
316+
knownPackages.addAll(packages);
326317
} while (!filesInLastPass.containsAll(filesInCurrentPass));
327-
if (!addingSpecials) {
328-
progressBarComplete();
329-
}
318+
progressBarComplete();
330319
}
331320

332321
/// Returns all top level library files in the 'lib/' directory of the given

lib/src/model/package_graph.dart

-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ class PackageGraph with CommentReferable, Nameable {
204204
final Map<Element, ModelNode> _modelNodes = {};
205205

206206
/// The Object class declared in the Dart SDK's 'dart:core' library.
207-
// TODO(srawlins): I think nothing depends on this any longer; remove.
208207
late InheritingContainer objectClass;
209208

210209
/// Populate's [_modelNodes] with elements in [resolvedLibrary].

0 commit comments

Comments
 (0)