| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library analysis_server.src.domain_diagnostic; | 5 library analysis_server.src.domain_diagnostic; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:core' hide Resource; | 8 import 'dart:core' hide Resource; |
| 9 | 9 |
| 10 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 10 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 if (context is AnalysisContextImpl) { | 56 if (context is AnalysisContextImpl) { |
| 57 workItems = _workItemCount(context); | 57 workItems = _workItemCount(context); |
| 58 var cache = context.analysisCache; | 58 var cache = context.analysisCache; |
| 59 if (cache is AnalysisCache) { | 59 if (cache is AnalysisCache) { |
| 60 Set<AnalysisTarget> countedTargets = new HashSet<AnalysisTarget>(); | 60 Set<AnalysisTarget> countedTargets = new HashSet<AnalysisTarget>(); |
| 61 MapIterator<AnalysisTarget, CacheEntry> iterator = cache.iterator(); | 61 MapIterator<AnalysisTarget, CacheEntry> iterator = cache.iterator(); |
| 62 while (iterator.moveNext()) { | 62 while (iterator.moveNext()) { |
| 63 AnalysisTarget target = iterator.key; | 63 AnalysisTarget target = iterator.key; |
| 64 if (countedTargets.add(target)) { | 64 if (countedTargets.add(target)) { |
| 65 CacheEntry cacheEntry = iterator.value; | 65 CacheEntry cacheEntry = iterator.value; |
| 66 if (cacheEntry == null) { |
| 67 throw new StateError( |
| 68 "mutated cache key detected: $target (${target.runtimeType})")
; |
| 69 } |
| 66 if (target is Source) { | 70 if (target is Source) { |
| 67 if (cacheEntry.explicitlyAdded) { | 71 if (cacheEntry.explicitlyAdded) { |
| 68 explicitFiles++; | 72 explicitFiles++; |
| 69 } else { | 73 } else { |
| 70 implicitFiles++; | 74 implicitFiles++; |
| 71 } | 75 } |
| 72 } | 76 } |
| 73 // Caught exceptions. | 77 // Caught exceptions. |
| 74 if (cacheEntry.exception != null) { | 78 if (cacheEntry.exception != null) { |
| 75 exceptions.add(cacheEntry.exception.toString()); | 79 exceptions.add(cacheEntry.exception.toString()); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 88 String requestName = request.method; | 92 String requestName = request.method; |
| 89 if (requestName == DIAGNOSTICS) { | 93 if (requestName == DIAGNOSTICS) { |
| 90 return computeDiagnostics(request); | 94 return computeDiagnostics(request); |
| 91 } | 95 } |
| 92 } on RequestFailure catch (exception) { | 96 } on RequestFailure catch (exception) { |
| 93 return exception.response; | 97 return exception.response; |
| 94 } | 98 } |
| 95 return null; | 99 return null; |
| 96 } | 100 } |
| 97 } | 101 } |
| OLD | NEW |