OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library kernel.type_algebra; | 4 library kernel.type_algebra; |
5 | 5 |
6 import 'ast.dart'; | 6 import 'ast.dart'; |
7 | 7 |
8 /// Returns a type where all occurrences of the given type parameters have been | 8 /// Returns a type where all occurrences of the given type parameters have been |
9 /// replaced with the corresponding types. | 9 /// replaced with the corresponding types. |
10 /// | 10 /// |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 | 634 |
635 bool visitTypeParameterType(TypeParameterType node) { | 635 bool visitTypeParameterType(TypeParameterType node) { |
636 return variables == null || variables.contains(node.parameter); | 636 return variables == null || variables.contains(node.parameter); |
637 } | 637 } |
638 | 638 |
639 bool handleTypeParameter(TypeParameter node) { | 639 bool handleTypeParameter(TypeParameter node) { |
640 assert(!variables.contains(node)); | 640 assert(!variables.contains(node)); |
641 return node.bound.accept(this); | 641 return node.bound.accept(this); |
642 } | 642 } |
643 } | 643 } |
644 | |
645 Map<dynamic/*=K*/, dynamic/*=W*/ > _mapValues/*<K,V,W>*/( | |
646 Map<dynamic/*=K*/, dynamic/*=V*/ > map, dynamic/*=W*/ fn(dynamic/*=V*/)) { | |
647 Map<dynamic/*=K*/, dynamic/*=W*/ > result = {}; | |
648 map.forEach((key, value) { | |
649 result[key] = fn(value); | |
650 }); | |
651 return result; | |
652 } | |
OLD | NEW |