Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Unified Diff: pkg/analysis_server/lib/src/context_manager.dart

Issue 2571353002: Fix updating source factory in driver (issue 28086) (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analysis_server/test/context_manager_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/context_manager.dart
diff --git a/pkg/analysis_server/lib/src/context_manager.dart b/pkg/analysis_server/lib/src/context_manager.dart
index ede7e98514f86c113fedf6b94058ee9ec6984e7b..b16e78201c69cdf26d8840764337e3080c0144ea 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -279,26 +279,26 @@ abstract class ContextManager {
List<AnalysisContext> contextsInAnalysisRoot(Folder analysisRoot);
/**
- * Return the [AnalysisDriver] for the "innermost" context whose associated
+ * Return the [AnalysisContext] for the "innermost" context whose associated
* folder is or contains the given path. ("innermost" refers to the nesting
* of contexts, so if there is a context for path /foo and a context for
* path /foo/bar, then the innermost context containing /foo/bar/baz.dart is
* the context for /foo/bar.)
*
- * If no driver contains the given path, `null` is returned.
+ * If no context contains the given path, `null` is returned.
*/
- AnalysisDriver getDriverFor(String path);
+ AnalysisContext getContextFor(String path);
/**
- * Return the [AnalysisContext] for the "innermost" context whose associated
+ * Return the [AnalysisDriver] for the "innermost" context whose associated
* folder is or contains the given path. ("innermost" refers to the nesting
* of contexts, so if there is a context for path /foo and a context for
* path /foo/bar, then the innermost context containing /foo/bar/baz.dart is
* the context for /foo/bar.)
*
- * If no context contains the given path, `null` is returned.
+ * If no driver contains the given path, `null` is returned.
*/
- AnalysisContext getContextFor(String path);
+ AnalysisDriver getDriverFor(String path);
/**
* Return a list of all of the analysis drivers reachable from the given
@@ -594,11 +594,6 @@ class ContextManagerImpl implements ContextManager {
bool definesEmbeddedLibs(Map map) => map[_EMBEDDED_LIB_MAP_KEY] != null;
@override
- AnalysisDriver getDriverFor(String path) {
- return _getInnermostContextInfoFor(path)?.analysisDriver;
- }
-
- @override
AnalysisContext getContextFor(String path) {
return _getInnermostContextInfoFor(path)?.context;
}
@@ -615,6 +610,11 @@ class ContextManagerImpl implements ContextManager {
}
@override
+ AnalysisDriver getDriverFor(String path) {
+ return _getInnermostContextInfoFor(path)?.analysisDriver;
+ }
+
+ @override
List<AnalysisDriver> getDriversInAnalysisRoot(Folder analysisRoot) {
List<AnalysisDriver> drivers = <AnalysisDriver>[];
void addContextAndDescendants(ContextInfo info) {
@@ -1706,10 +1706,18 @@ class ContextManagerImpl implements ContextManager {
}
void _updateContextPackageUriResolver(Folder contextFolder) {
- AnalysisContext context = folderMap[contextFolder];
- context.sourceFactory =
- _createSourceFactory(context, context.analysisOptions, contextFolder);
- callbacks.updateContextPackageUriResolver(context);
+ if (enableNewAnalysisDriver) {
+ ContextInfo info = getContextInfoFor(contextFolder);
+ AnalysisDriver driver = info.analysisDriver;
+ SourceFactory sourceFactory =
+ _createSourceFactory(null, driver.analysisOptions, contextFolder);
+ driver.configure(sourceFactory: sourceFactory);
+ } else {
+ AnalysisContext context = folderMap[contextFolder];
+ context.sourceFactory =
+ _createSourceFactory(context, context.analysisOptions, contextFolder);
+ callbacks.updateContextPackageUriResolver(context);
+ }
}
/**
« no previous file with comments | « no previous file | pkg/analysis_server/test/context_manager_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698