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

Side by Side Diff: pkg/analysis_server/lib/src/domain_diagnostic.dart

Issue 1698093004: Throw a better exception for a modified analysis cache key (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698