Skip to content

In PackageBuilder._discoverLibraries, initialize newFiles outside loop. #3695

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions lib/src/model/package_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,10 @@ class PubPackageBuilder implements PackageBuilder {
// a set of files (starting with the ones passed into the function), resolve
// them, add them to the package graph via `addLibrary`, and then discover
// which additional files need to be processed in the next loop. This
// discovery depends on various options (TODO: which?), but the basic idea
// is to take a file we've just processed, and add all of the files which
// that file references via imports or exports, and add them to the set of
// files to be processed.
// discovery depends on various options (TODO: which?). The basic idea is
// to take a file we've just processed, and add all of the files which that
// file references (via imports, augmentation imports, exports, and parts),
// and add them to the set of files to be processed.
//
// This loop may execute a few times. We know to stop looping when we have
// added zero new files to process. This is tracked with `filesInLastPass`
Expand All @@ -247,9 +247,11 @@ class PubPackageBuilder implements PackageBuilder {
if (!addingSpecials) {
progressBarStart(files.length);
}
// The set of files that are discovered while iterating in the below
// do-while loop, which are then added to `files`, as they are found.
var newFiles = <String>{};
do {
filesInLastPass = filesInCurrentPass;
var newFiles = <String>{};
if (!addingSpecials) {
progressBarUpdateTickCount(files.length);
}
Expand Down