OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 dart_types; | 5 library dart_types; |
6 | 6 |
7 import 'dart:math' show min; | 7 import 'dart:math' show min; |
8 | 8 |
9 import 'core_types.dart'; | 9 import 'core_types.dart'; |
10 import 'dart2jslib.dart' show Compiler, invariant, Script, Message; | 10 import 'dart2jslib.dart' show Compiler, invariant, Script, Message; |
(...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1225 TypeVariableType typeVariable, | 1225 TypeVariableType typeVariable, |
1226 DartType bound); | 1226 DartType bound); |
1227 | 1227 |
1228 /// Basic interface for the Dart type system. | 1228 /// Basic interface for the Dart type system. |
1229 abstract class DartTypes { | 1229 abstract class DartTypes { |
1230 /// The types defined in 'dart:core'. | 1230 /// The types defined in 'dart:core'. |
1231 CoreTypes get coreTypes; | 1231 CoreTypes get coreTypes; |
1232 | 1232 |
1233 /// Returns `true` if [t] is a subtype of [s]. | 1233 /// Returns `true` if [t] is a subtype of [s]. |
1234 bool isSubtype(DartType t, DartType s); | 1234 bool isSubtype(DartType t, DartType s); |
| 1235 |
| 1236 /// Returns `true` if [t] might be a subtype of [s] for some values of |
| 1237 /// type variables in [s] and [t]. |
| 1238 bool isPotentialSubtype(DartType t, DartType s); |
1235 } | 1239 } |
1236 | 1240 |
1237 class Types implements DartTypes { | 1241 class Types implements DartTypes { |
1238 // TODO(johnniwinther): Replace by [CoreTypes]. | 1242 // TODO(johnniwinther): Replace by [CoreTypes]. |
1239 final Compiler compiler; | 1243 final Compiler compiler; |
1240 final MoreSpecificVisitor moreSpecificVisitor; | 1244 final MoreSpecificVisitor moreSpecificVisitor; |
1241 final SubtypeVisitor subtypeVisitor; | 1245 final SubtypeVisitor subtypeVisitor; |
1242 final PotentialSubtypeVisitor potentialSubtypeVisitor; | 1246 final PotentialSubtypeVisitor potentialSubtypeVisitor; |
1243 | 1247 |
1244 CoreTypes get coreTypes => compiler.coreTypes; | 1248 CoreTypes get coreTypes => compiler.coreTypes; |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1878 } | 1882 } |
1879 namedParameterTypes[index].accept(this, namedParameters[index]); | 1883 namedParameterTypes[index].accept(this, namedParameters[index]); |
1880 needsComma = true; | 1884 needsComma = true; |
1881 } | 1885 } |
1882 sb.write('}'); | 1886 sb.write('}'); |
1883 } | 1887 } |
1884 sb.write(')'); | 1888 sb.write(')'); |
1885 } | 1889 } |
1886 } | 1890 } |
1887 | 1891 |
OLD | NEW |