analyzer: Use Workspace.partialSourceFactory in more places

For better caching.

Change-Id: Ia5c9df85169731ae256dfe68cfe54115a9b402f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489540
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
This commit is contained in:
Sam Rawlins
2026-03-20 13:52:02 -07:00
committed by Commit Queue
parent 6a62dbbb0f
commit 43b930673e
2 changed files with 5 additions and 7 deletions
@@ -247,8 +247,7 @@ class ContextBuilderImpl {
);
{
// TODO(scheglov): We already had partial SourceFactory in ContextLocatorImpl.
var partialSourceFactory = workspace.createSourceFactory(null, null);
var partialSourceFactory = workspace.partialSourceFactory;
var embedderYamlSource = partialSourceFactory.forUri(
'package:sky_engine/_embedder.yaml',
);
@@ -242,7 +242,9 @@ class _ContextLocator {
required _RootLocation location,
}) {
if (location.workspace is WorkspaceWithDefaultAnalysisOptions) {
optionsFile ??= _findDefaultOptionsFile(location.sourceFactory);
optionsFile ??= _findDefaultOptionsFile(
location.workspace.partialSourceFactory,
);
}
var root = ContextRootImpl(
@@ -257,7 +259,7 @@ class _ContextLocator {
}
root.excludedGlobs.addAll(
_getExcludedGlobs(optionsFile, location.sourceFactory),
_getExcludedGlobs(optionsFile, location.workspace.partialSourceFactory),
);
roots.add(root);
return root;
@@ -918,9 +920,6 @@ class _RootLocation {
final File? optionsFile;
final File? packageConfigFile;
/// A single source factory for [workspace].
late final sourceFactory = workspace.createSourceFactory(null, null);
_RootLocation({
required this.rootFolder,
required this.workspace,