OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 import 'dart:convert' hide JsonDecoder; | 6 import 'dart:convert' hide JsonDecoder; |
7 | 7 |
8 import 'package:analysis_server/protocol/protocol.dart'; | 8 import 'package:analysis_server/protocol/protocol.dart'; |
9 import 'package:analysis_server/protocol/protocol_generated.dart'; | 9 import 'package:analysis_server/protocol/protocol_generated.dart'; |
10 import 'package:analyzer_plugin/protocol/protocol_common.dart'; | 10 import 'package:analyzer_plugin/protocol/protocol_common.dart'; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 return false; | 129 return false; |
130 } | 130 } |
131 } | 131 } |
132 return true; | 132 return true; |
133 } | 133 } |
134 | 134 |
135 /** | 135 /** |
136 * Translate the input [map], applying [keyCallback] to all its keys, and | 136 * Translate the input [map], applying [keyCallback] to all its keys, and |
137 * [valueCallback] to all its values. | 137 * [valueCallback] to all its values. |
138 */ | 138 */ |
139 Map/*<KR, VR>*/ mapMap/*<KP, VP, KR, VR>*/(Map/*<KP, VP>*/ map, | 139 Map<KR, VR> mapMap<KP, VP, KR, VR>(Map<KP, VP> map, |
140 {dynamic/*=KR*/ keyCallback(/*<KP>*/ key), | 140 {KR keyCallback(KP key), VR valueCallback(VP value)}) { |
141 dynamic/*=VR*/ valueCallback(/*<VP>*/ value)}) { | 141 Map<KR, VR> result = new HashMap<KR, VR>(); |
142 Map/*<KR, VR>*/ result = new HashMap/*<KR, VR>*/(); | |
143 map.forEach((key, value) { | 142 map.forEach((key, value) { |
144 Object/*=KR*/ resultKey; | 143 KR resultKey; |
145 Object/*=VR*/ resultValue; | 144 VR resultValue; |
146 if (keyCallback != null) { | 145 if (keyCallback != null) { |
147 resultKey = keyCallback(key); | 146 resultKey = keyCallback(key); |
148 } else { | 147 } else { |
149 resultKey = key as Object/*=KR*/; | 148 resultKey = key as KR; |
150 } | 149 } |
151 if (valueCallback != null) { | 150 if (valueCallback != null) { |
152 resultValue = valueCallback(value); | 151 resultValue = valueCallback(value); |
153 } else { | 152 } else { |
154 resultValue = value as Object/*=VR*/; | 153 resultValue = value as VR; |
155 } | 154 } |
156 result[resultKey] = resultValue; | 155 result[resultKey] = resultValue; |
157 }); | 156 }); |
158 return result; | 157 return result; |
159 } | 158 } |
160 | 159 |
161 RefactoringProblemSeverity maxRefactoringProblemSeverity( | 160 RefactoringProblemSeverity maxRefactoringProblemSeverity( |
162 RefactoringProblemSeverity a, RefactoringProblemSeverity b) { | 161 RefactoringProblemSeverity a, RefactoringProblemSeverity b) { |
163 if (b == null) { | 162 if (b == null) { |
164 return a; | 163 return a; |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 /** | 326 /** |
328 * The result data associated with a response. | 327 * The result data associated with a response. |
329 */ | 328 */ |
330 abstract class ResponseResult implements HasToJson { | 329 abstract class ResponseResult implements HasToJson { |
331 /** | 330 /** |
332 * Return a response whose result data is this object for the request with the | 331 * Return a response whose result data is this object for the request with the |
333 * given [id]. | 332 * given [id]. |
334 */ | 333 */ |
335 Response toResponse(String id); | 334 Response toResponse(String id); |
336 } | 335 } |
OLD | NEW |