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

Side by Side Diff: pkg/analysis_server/lib/src/plugin/result_collector.dart

Issue 2685613002: Use toList to copy lists and clean up errors and warnings (Closed)
Patch Set: Created 3 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 | pkg/analysis_server/lib/src/plugin/result_merger.dart » ('j') | 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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 /** 5 /**
6 * An object used to collect partial results (of type [E]) where the partial 6 * An object used to collect partial results (of type [E]) where the partial
7 * results are contributed by plugins. 7 * results are contributed by plugins.
8 */ 8 */
9 class ResultCollector<E> { 9 class ResultCollector<E> {
10 /** 10 /**
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 void clearResultsFromPlugin(String pluginId) { 42 void clearResultsFromPlugin(String pluginId) {
43 for (Map<String, E> partialResults in resultMap.values) { 43 for (Map<String, E> partialResults in resultMap.values) {
44 partialResults.remove(pluginId); 44 partialResults.remove(pluginId);
45 } 45 }
46 } 46 }
47 47
48 /** 48 /**
49 * Return an iterator producing the partial results that have been contributed 49 * Return an iterator producing the partial results that have been contributed
50 * for the given [filePath]. 50 * for the given [filePath].
51 */ 51 */
52 Iterable<E> getResults(String filePath) { 52 List<E> getResults(String filePath) {
53 Map<String, E> partialResultMap = resultMap[filePath]; 53 Map<String, E> partialResultMap = resultMap[filePath];
54 if (partialResultMap == null) { 54 if (partialResultMap == null) {
55 return <E>[]; 55 return <E>[];
56 } 56 }
57 List<E> values = partialResultMap.values.toList(); 57 List<E> values = partialResultMap.values.toList();
58 // 58 //
59 // Ensure that the server's contributions are always first in the list. 59 // Ensure that the server's contributions are always first in the list.
60 // 60 //
61 E serverContributions = partialResultMap[serverId]; 61 E serverContributions = partialResultMap[serverId];
62 if (serverContributions != null && values.remove(serverContributions)) { 62 if (serverContributions != null && values.remove(serverContributions)) {
(...skipping 24 matching lines...) Expand all
87 87
88 /** 88 /**
89 * Stop collecting results contributed for the file with the given [filePath]. 89 * Stop collecting results contributed for the file with the given [filePath].
90 * Until the collector is told to start collecting results for the file, any 90 * Until the collector is told to start collecting results for the file, any
91 * results that are contributed for the file are discarded. 91 * results that are contributed for the file are discarded.
92 */ 92 */
93 void stopCollectingFor(String filePath) { 93 void stopCollectingFor(String filePath) {
94 resultMap.remove(filePath); 94 resultMap.remove(filePath);
95 } 95 }
96 } 96 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/plugin/result_merger.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698