| OLD | NEW |
| 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 import 'dart:collection'; | 5 import 'dart:collection'; |
| 6 | 6 |
| 7 import 'package:analysis_server/protocol/protocol_generated.dart'; | 7 import 'package:analysis_server/protocol/protocol_generated.dart'; |
| 8 import 'package:analyzer_plugin/protocol/protocol_common.dart'; | 8 import 'package:analyzer_plugin/protocol/protocol_common.dart'; |
| 9 import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin; | 9 import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin; |
| 10 import 'package:meta/meta.dart'; | 10 import 'package:meta/meta.dart'; |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 return partialResultList[0]; | 195 return partialResultList[0]; |
| 196 } | 196 } |
| 197 List<HighlightRegion> mergedRegions = <HighlightRegion>[]; | 197 List<HighlightRegion> mergedRegions = <HighlightRegion>[]; |
| 198 for (List<HighlightRegion> partialResults in partialResultList) { | 198 for (List<HighlightRegion> partialResults in partialResultList) { |
| 199 mergedRegions.addAll(partialResults); | 199 mergedRegions.addAll(partialResults); |
| 200 } | 200 } |
| 201 return mergedRegions; | 201 return mergedRegions; |
| 202 } | 202 } |
| 203 | 203 |
| 204 /** | 204 /** |
| 205 * Return kythe entry result parameters composed by merging the parameters in |
| 206 * the [partialResultList]. |
| 207 * |
| 208 * The resulting list will contain all of the kythe entries from all of the |
| 209 * plugins. If a plugin contributes a kythe entry that is the same as the |
| 210 * entry from a different plugin, the entry will appear twice in the list. |
| 211 */ |
| 212 KytheGetKytheEntriesResult mergeKytheEntries( |
| 213 List<KytheGetKytheEntriesResult> partialResultList) { |
| 214 List<KytheEntry> mergedEntries = <KytheEntry>[]; |
| 215 Set<String> mergedFiles = new Set<String>(); |
| 216 for (KytheGetKytheEntriesResult partialResult in partialResultList) { |
| 217 mergedEntries.addAll(partialResult.entries); |
| 218 mergedFiles.addAll(partialResult.files); |
| 219 } |
| 220 return new KytheGetKytheEntriesResult(mergedEntries, mergedFiles.toList()); |
| 221 } |
| 222 |
| 223 /** |
| 205 * Return navigation notification parameters composed by merging the | 224 * Return navigation notification parameters composed by merging the |
| 206 * parameters in the [partialResultList]. | 225 * parameters in the [partialResultList]. |
| 207 * | 226 * |
| 208 * The resulting list will contain all of the navigation regions from all of | 227 * The resulting list will contain all of the navigation regions from all of |
| 209 * the plugins. If a plugin contributes a navigation region that overlaps a | 228 * the plugins. If a plugin contributes a navigation region that overlaps a |
| 210 * region from a previous plugin, the overlapping region will be omitted. (For | 229 * region from a previous plugin, the overlapping region will be omitted. (For |
| 211 * these purposes, nested regions are considered to be overlapping.) | 230 * these purposes, nested regions are considered to be overlapping.) |
| 212 */ | 231 */ |
| 213 AnalysisNavigationParams mergeNavigation( | 232 AnalysisNavigationParams mergeNavigation( |
| 214 List<AnalysisNavigationParams> partialResultList) { | 233 List<AnalysisNavigationParams> partialResultList) { |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 if (leftEnd < rightStart || leftStart > rightEnd) { | 837 if (leftEnd < rightStart || leftStart > rightEnd) { |
| 819 return false; | 838 return false; |
| 820 } | 839 } |
| 821 if (!allowNesting) { | 840 if (!allowNesting) { |
| 822 return true; | 841 return true; |
| 823 } | 842 } |
| 824 return !((leftStart <= rightStart && rightEnd <= leftEnd) || | 843 return !((leftStart <= rightStart && rightEnd <= leftEnd) || |
| 825 (rightStart <= leftStart && leftEnd <= rightEnd)); | 844 (rightStart <= leftStart && leftEnd <= rightEnd)); |
| 826 } | 845 } |
| 827 } | 846 } |
| OLD | NEW |