| 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_environment; | 4 library kernel.type_environment; |
| 5 | 5 |
| 6 import 'ast.dart'; | 6 import 'ast.dart'; |
| 7 import 'class_hierarchy.dart'; | 7 import 'class_hierarchy.dart'; |
| 8 import 'core_types.dart'; | 8 import 'core_types.dart'; |
| 9 import 'type_algebra.dart'; | 9 import 'type_algebra.dart'; |
| 10 | 10 |
| 11 typedef void ErrorHandler(TreeNode node, String message); | 11 typedef void ErrorHandler(TreeNode node, String message); |
| 12 | 12 |
| 13 class TypeEnvironment extends SubtypeTester { | 13 class TypeEnvironment extends SubtypeTester { |
| 14 final CoreTypes coreTypes; | 14 final CoreTypes coreTypes; |
| 15 final ClassHierarchy hierarchy; | 15 final ClassHierarchy hierarchy; |
| 16 InterfaceType thisType; | 16 InterfaceType thisType; |
| 17 | 17 |
| 18 DartType returnType; | 18 DartType returnType; |
| 19 DartType yieldType; | 19 DartType yieldType; |
| 20 AsyncMarker currentAsyncMarker = AsyncMarker.Sync; |
| 20 | 21 |
| 21 /// An error handler for use in debugging, or `null` if type errors should not | 22 /// An error handler for use in debugging, or `null` if type errors should not |
| 22 /// be tolerated. See [typeError]. | 23 /// be tolerated. See [typeError]. |
| 23 ErrorHandler errorHandler; | 24 ErrorHandler errorHandler; |
| 24 | 25 |
| 25 TypeEnvironment(this.coreTypes, this.hierarchy); | 26 TypeEnvironment(this.coreTypes, this.hierarchy); |
| 26 | 27 |
| 27 InterfaceType get objectType => coreTypes.objectClass.rawType; | 28 InterfaceType get objectType => coreTypes.objectClass.rawType; |
| 28 InterfaceType get nullType => coreTypes.nullClass.rawType; | 29 InterfaceType get nullType => coreTypes.nullClass.rawType; |
| 29 InterfaceType get boolType => coreTypes.boolClass.rawType; | 30 InterfaceType get boolType => coreTypes.boolClass.rawType; |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 var subtypeParameter = subtype.namedParameters[name]; | 211 var subtypeParameter = subtype.namedParameters[name]; |
| 211 if (subtypeParameter == null) return false; | 212 if (subtypeParameter == null) return false; |
| 212 // Termination: Both types shrink in size. | 213 // Termination: Both types shrink in size. |
| 213 if (!isSubtypeOf(supertypeParameter, subtypeParameter)) { | 214 if (!isSubtypeOf(supertypeParameter, subtypeParameter)) { |
| 214 return false; | 215 return false; |
| 215 } | 216 } |
| 216 } | 217 } |
| 217 return true; | 218 return true; |
| 218 } | 219 } |
| 219 } | 220 } |
| OLD | NEW |