Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: lib/type_environment.dart

Issue 2473523004: Fix expected return type in async functions (Closed)
Patch Set: Also handle yield* Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/type_checker.dart ('k') | testcases/input/async_function.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « lib/type_checker.dart ('k') | testcases/input/async_function.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698