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

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

Issue 3003173002: Remove more references to AnalysisContext (Closed)
Patch Set: Created 3 years, 4 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
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/operation/operation_analysis.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/domain_diagnostic.dart
diff --git a/pkg/analysis_server/lib/src/domain_diagnostic.dart b/pkg/analysis_server/lib/src/domain_diagnostic.dart
index ce4974e9d73efb00bb2f31872ec864a49abd7ecb..81bff6b0d40dbb5e9748493b20acbbc328193737 100644
--- a/pkg/analysis_server/lib/src/domain_diagnostic.dart
+++ b/pkg/analysis_server/lib/src/domain_diagnostic.dart
@@ -3,27 +3,13 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
-import 'dart:collection';
import 'dart:core';
import 'package:analysis_server/protocol/protocol.dart';
import 'package:analysis_server/protocol/protocol_constants.dart';
import 'package:analysis_server/protocol/protocol_generated.dart';
import 'package:analysis_server/src/analysis_server.dart';
-import 'package:analyzer/src/context/cache.dart';
-import 'package:analyzer/src/context/context.dart';
-import 'package:analyzer/src/dart/analysis/driver.dart' as nd;
-import 'package:analyzer/src/generated/engine.dart';
-import 'package:analyzer/src/generated/source.dart';
-import 'package:analyzer/src/generated/utilities_collection.dart';
-import 'package:analyzer/src/task/driver.dart';
-import 'package:analyzer/task/model.dart';
-
-int _workItemCount(AnalysisContextImpl context) {
- AnalysisDriver driver = context.driver;
- List<WorkItem> items = driver.currentWorkOrder?.workItems;
- return items?.length ?? 0;
-}
+import 'package:analyzer/src/dart/analysis/driver.dart';
/// Instances of the class [DiagnosticDomainHandler] implement a
/// [RequestHandler] that handles requests in the `diagnostic` domain.
@@ -42,47 +28,8 @@ class DiagnosticDomainHandler implements RequestHandler {
return new DiagnosticGetDiagnosticsResult(contexts).toResponse(request.id);
}
- /// Extract context data from the given [context].
- ContextData extractDataFromContext(AnalysisContext context) {
- int explicitFiles = 0;
- int implicitFiles = 0;
- int workItems = 0;
- Set<String> exceptions = new HashSet<String>();
- if (context is AnalysisContextImpl) {
- workItems = _workItemCount(context);
- var cache = context.analysisCache;
- if (cache is AnalysisCache) {
- Set<AnalysisTarget> countedTargets = new HashSet<AnalysisTarget>();
- MapIterator<AnalysisTarget, CacheEntry> iterator = cache.iterator();
- while (iterator.moveNext()) {
- AnalysisTarget target = iterator.key;
- if (countedTargets.add(target)) {
- CacheEntry cacheEntry = iterator.value;
- if (cacheEntry == null) {
- throw new StateError(
- "mutated cache key detected: $target (${target.runtimeType})");
- }
- if (target is Source) {
- if (cacheEntry.explicitlyAdded) {
- explicitFiles++;
- } else {
- implicitFiles++;
- }
- }
- // Caught exceptions.
- if (cacheEntry.exception != null) {
- exceptions.add(cacheEntry.exception.toString());
- }
- }
- }
- }
- }
- return new ContextData(context.name, explicitFiles, implicitFiles,
- workItems, exceptions.toList());
- }
-
/// Extract context data from the given [driver].
- ContextData extractDataFromDriver(nd.AnalysisDriver driver) {
+ ContextData extractDataFromDriver(AnalysisDriver driver) {
int explicitFileCount = driver.addedFiles.length;
int knownFileCount = driver.knownFiles.length;
return new ContextData(driver.name, explicitFileCount,
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/operation/operation_analysis.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698