OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 related_types; | 5 library related_types; |
6 | 6 |
7 import 'package:compiler/src/commandline_options.dart'; | 7 import 'package:compiler/src/commandline_options.dart'; |
8 import 'package:compiler/src/compiler.dart'; | 8 import 'package:compiler/src/compiler.dart'; |
9 import 'package:compiler/src/core_types.dart'; | 9 import 'package:compiler/src/core_types.dart'; |
10 import 'package:compiler/src/dart_types.dart'; | 10 import 'package:compiler/src/dart_types.dart'; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 if (leftClass != null && rightClass != null) { | 90 if (leftClass != null && rightClass != null) { |
91 return !world.haveAnyCommonSubtypes(leftClass, rightClass); | 91 return !world.haveAnyCommonSubtypes(leftClass, rightClass); |
92 } | 92 } |
93 return false; | 93 return false; |
94 } | 94 } |
95 | 95 |
96 /// Checks that there exists a common subtype of [left] and [right] or report | 96 /// Checks that there exists a common subtype of [left] and [right] or report |
97 /// a hint otherwise. | 97 /// a hint otherwise. |
98 void checkRelated(Node node, DartType left, DartType right) { | 98 void checkRelated(Node node, DartType left, DartType right) { |
99 if (hasEmptyIntersection(left, right)) { | 99 if (hasEmptyIntersection(left, right)) { |
100 compiler.reportHint( | 100 compiler.reportHint(compiler.createMessage( |
101 node, MessageKind.NO_COMMON_SUBTYPES, {'left': left, 'right': right}); | 101 node, |
| 102 MessageKind.NO_COMMON_SUBTYPES, |
| 103 {'left': left, 'right': right})); |
102 } | 104 } |
103 } | 105 } |
104 | 106 |
105 /// Check weakly typed collection methods, like `Map.containsKey`, | 107 /// Check weakly typed collection methods, like `Map.containsKey`, |
106 /// `Map.containsValue` and `Iterable.contains`. | 108 /// `Map.containsValue` and `Iterable.contains`. |
107 void checkDynamicInvoke( | 109 void checkDynamicInvoke( |
108 Node node, | 110 Node node, |
109 DartType receiverType, | 111 DartType receiverType, |
110 List<DartType> argumentTypes, | 112 List<DartType> argumentTypes, |
111 Selector selector) { | 113 Selector selector) { |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 ClassElement findClass(DartType type) => type.accept(this, null); | 424 ClassElement findClass(DartType type) => type.accept(this, null); |
423 | 425 |
424 @override | 426 @override |
425 ClassElement visitType(DartType type, _) => null; | 427 ClassElement visitType(DartType type, _) => null; |
426 | 428 |
427 @override | 429 @override |
428 ClassElement visitInterfaceType(InterfaceType type, _) { | 430 ClassElement visitInterfaceType(InterfaceType type, _) { |
429 return type.element; | 431 return type.element; |
430 } | 432 } |
431 } | 433 } |
OLD | NEW |