| 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 library analysis_server.src.protocol.protocol_internal; | 5 library analysis_server.src.protocol.protocol_internal; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:convert' hide JsonDecoder; | 8 import 'dart:convert' hide JsonDecoder; |
| 9 | 9 |
| 10 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 10 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 return false; | 124 return false; |
| 125 } | 125 } |
| 126 } | 126 } |
| 127 return true; | 127 return true; |
| 128 } | 128 } |
| 129 | 129 |
| 130 /** | 130 /** |
| 131 * Translate the input [map], applying [keyCallback] to all its keys, and | 131 * Translate the input [map], applying [keyCallback] to all its keys, and |
| 132 * [valueCallback] to all its values. | 132 * [valueCallback] to all its values. |
| 133 */ | 133 */ |
| 134 mapMap(Map map, {dynamic keyCallback(key), dynamic valueCallback(value)}) { | 134 Map/*<KR, VR>*/ mapMap/*<KP, VP, KR, VR>*/(Map/*<KP, VP>*/ map, |
| 135 Map result = {}; | 135 {dynamic/*=KR*/ keyCallback(/*<KP>*/ key), |
| 136 dynamic/*=VR*/ valueCallback(/*<VP>*/ value)}) { |
| 137 Map/*<KR, VR>*/ result = new HashMap/*<KR, VR>*/(); |
| 136 map.forEach((key, value) { | 138 map.forEach((key, value) { |
| 139 Object/*=KR*/ resultKey; |
| 140 Object/*=VR*/ resultValue; |
| 137 if (keyCallback != null) { | 141 if (keyCallback != null) { |
| 138 key = keyCallback(key); | 142 resultKey = keyCallback(key); |
| 143 } else { |
| 144 resultKey = key as Object/*=KR*/; |
| 139 } | 145 } |
| 140 if (valueCallback != null) { | 146 if (valueCallback != null) { |
| 141 value = valueCallback(value); | 147 resultValue = valueCallback(value); |
| 148 } else { |
| 149 resultValue = value as Object/*=VR*/; |
| 142 } | 150 } |
| 143 result[key] = value; | 151 result[resultKey] = resultValue; |
| 144 }); | 152 }); |
| 145 return result; | 153 return result; |
| 146 } | 154 } |
| 147 | 155 |
| 148 RefactoringProblemSeverity maxRefactoringProblemSeverity( | 156 RefactoringProblemSeverity maxRefactoringProblemSeverity( |
| 149 RefactoringProblemSeverity a, RefactoringProblemSeverity b) { | 157 RefactoringProblemSeverity a, RefactoringProblemSeverity b) { |
| 150 if (b == null) { | 158 if (b == null) { |
| 151 return a; | 159 return a; |
| 152 } | 160 } |
| 153 if (a == null) { | 161 if (a == null) { |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 buffer.write(' at '); | 468 buffer.write(' at '); |
| 461 buffer.write(jsonPath); | 469 buffer.write(jsonPath); |
| 462 return new Exception(buffer.toString()); | 470 return new Exception(buffer.toString()); |
| 463 } | 471 } |
| 464 | 472 |
| 465 @override | 473 @override |
| 466 dynamic missingKey(String jsonPath, String key) { | 474 dynamic missingKey(String jsonPath, String key) { |
| 467 return new Exception('Missing key $key at $jsonPath'); | 475 return new Exception('Missing key $key at $jsonPath'); |
| 468 } | 476 } |
| 469 } | 477 } |
| OLD | NEW |