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

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

Issue 2949103003: Remove more dead code from analysis server (Closed)
Patch Set: Created 3 years, 6 months 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
Index: pkg/analysis_server/lib/src/analysis_server.dart
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index be00f35c7e782091a4ee859550aaae7284eea08f..8090fe6c9f365095155ae6cc0baf17c4b2e65efd 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -320,12 +320,6 @@ class AnalysisServer {
final AnalysisOptionsImpl defaultContextOptions = new AnalysisOptionsImpl();
/**
- * The controller for sending [ContextsChangedEvent]s.
- */
- StreamController<ContextsChangedEvent> _onContextsChangedController =
- new StreamController<ContextsChangedEvent>.broadcast();
-
- /**
* The file resolver provider used to override the way file URI's are
* resolved in some contexts.
*/
@@ -484,13 +478,6 @@ class AnalysisServer {
}
/**
- * Return the [AnalysisContext]s that are being used to analyze the analysis
- * roots.
- */
- Iterable<AnalysisContext> get analysisContexts =>
- contextManager.analysisContexts;
-
- /**
* Return a list of the globs used to determine which files should be analyzed.
*/
List<Glob> get analyzedFilesGlobs {
@@ -517,12 +504,6 @@ class AnalysisServer {
Map<Folder, nd.AnalysisDriver> get driverMap => contextManager.driverMap;
/**
- * Return a table mapping [Folder]s to the [AnalysisContext]s associated with
- * them.
- */
- Map<Folder, AnalysisContext> get folderMap => contextManager.folderMap;
-
- /**
* The [Future] that completes when analysis is complete.
*/
Future get onAnalysisComplete {
@@ -543,12 +524,6 @@ class AnalysisServer {
}
/**
- * The stream that is notified when contexts are added or removed.
- */
- Stream<ContextsChangedEvent> get onContextsChanged =>
- _onContextsChangedController.stream;
-
- /**
* The stream that is notified when a single file has been added. This exists
* as a temporary stopgap for plugins, until the official plugin API is
* complete.
@@ -687,19 +662,6 @@ class AnalysisServer {
}
/**
- * 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 context contains the given path, `null` is returned.
- */
- AnalysisContext getContainingContext(String path) {
- return contextManager.getContextFor(path);
- }
-
- /**
* Return the [nd.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
@@ -770,23 +732,6 @@ class AnalysisServer {
return result?.unit;
}
-// TODO(brianwilkerson) Add the following method after 'prioritySources' has
-// been added to InternalAnalysisContext.
-// /**
-// * Return a list containing the full names of all of the sources that are
-// * priority sources.
-// */
-// List<String> getPriorityFiles() {
-// List<String> priorityFiles = new List<String>();
-// folderMap.values.forEach((ContextDirectory directory) {
-// InternalAnalysisContext context = directory.context;
-// context.prioritySources.forEach((Source source) {
-// priorityFiles.add(source.fullName);
-// });
-// });
-// return priorityFiles;
-// }
-
/**
* Handle a [request] that was read from the communication channel.
*/
@@ -924,9 +869,12 @@ class AnalysisServer {
if (roots == null) {
operationQueue.clear();
} else {
- for (AnalysisContext context in _getContexts(roots)) {
- operationQueue.contextRemoved(context);
- }
+ // TODO(brianwilkerson) All of the contexts returned by _getContexts will
+ // be null. If we are still using the operation queue, then this needs to
+ // be changed to use drivers.
+// for (AnalysisContext context in _getContexts(roots)) {
+// operationQueue.contextRemoved(context);
+// }
}
// Instruct the contextDirectoryManager to rebuild all contexts from
// scratch.
@@ -1314,20 +1262,6 @@ class AnalysisServer {
return null;
}
- /**
- * Return a set of all contexts whose associated folder is contained within,
- * or equal to, one of the resources in the given list of [resources].
- */
- Set<AnalysisContext> _getContexts(List<Resource> resources) {
- Set<AnalysisContext> contexts = new HashSet<AnalysisContext>();
- resources.forEach((Resource resource) {
- if (resource is Folder) {
- contexts.addAll(contextManager.contextsInAnalysisRoot(resource));
- }
- });
- return contexts;
- }
-
bool _hasAnalysisServiceSubscription(AnalysisService service, String file) {
return analysisServices[service]?.contains(file) ?? false;
}
@@ -1378,10 +1312,10 @@ class AnalysisServer {
if (index == null) {
return;
}
- onContextsChanged.listen((ContextsChangedEvent event) {
- // TODO(brianwilkerson) `onContextsChanged` should never have anything
- // written to it. Figure out whether we need something like this under the
- // new analysis driver, and remove this method if not.
+ // TODO(brianwilkerson) onContextsChanged never has anything written to it.
+ // Figure out whether we need something like this under the new analysis
+ // driver, and remove this method if not.
+// onContextsChanged.listen((ContextsChangedEvent event) {
// for (AnalysisContext context in event.added) {
// context
// .onResultChanged(RESOLVED_UNIT3)
@@ -1405,7 +1339,7 @@ class AnalysisServer {
// for (AnalysisContext context in event.removed) {
// index.removeContext(context);
// }
- });
+// });
}
}
@@ -1424,27 +1358,6 @@ class AnalysisServerOptions {
}
/**
- * Information about a file - an [AnalysisContext] that analyses the file,
- * and the [Source] representing the file in this context.
- */
-class ContextSourcePair {
- /**
- * A context that analysis the file.
- * May be `null` if the file is not analyzed by any context.
- */
- final AnalysisContext context;
-
- /**
- * The source that corresponds to the file.
- * May be `null` if the file is not a regular file.
- * If the file cannot be found in the [context], then it has a `file` uri.
- */
- final Source source;
-
- ContextSourcePair(this.context, this.source);
-}
-
-/**
* A [PriorityChangeEvent] indicates the set the priority files has changed.
*/
class PriorityChangeEvent {
@@ -1576,19 +1489,6 @@ class ServerContextManagerCallbacks extends ContextManagerCallbacks {
}
@override
- AnalysisContext addContext(Folder folder, AnalysisOptions options) {
- ContextBuilder builder = createContextBuilder(folder, options);
- AnalysisContext context = builder.buildContext(folder.path);
-
- analysisServer.folderMap[folder] = context;
- analysisServer._onContextsChangedController
- .add(new ContextsChangedEvent(added: [context]));
- analysisServer.schedulePerformAnalysisOperation(context);
-
- return context;
- }
-
- @override
void applyChangesToContext(Folder contextFolder, ChangeSet changeSet) {
nd.AnalysisDriver analysisDriver = analysisServer.driverMap[contextFolder];
if (analysisDriver != null) {
@@ -1670,13 +1570,6 @@ class ServerContextManagerCallbacks extends ContextManagerCallbacks {
driver.dispose();
}
- @override
- void updateContextPackageUriResolver(AnalysisContext context) {
- analysisServer._onContextsChangedController
- .add(new ContextsChangedEvent(changed: [context]));
- analysisServer.schedulePerformAnalysisOperation(context);
- }
-
List<HighlightRegion> _computeHighlightRegions(CompilationUnit unit) {
if (analysisServer.options.useAnalysisHighlight2) {
return new DartUnitHighlightsComputer2(unit).compute();

Powered by Google App Engine
This is Rietveld 408576698