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

Side by Side Diff: test/dart_codegen/expect/async/future.dart

Issue 1038213003: Downward inference (Closed) Base URL: git@github.com:dart-lang/dart-dev-compiler.git@master
Patch Set: Address comments Created 5 years, 8 months 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
OLDNEW
1 part of dart.async; 1 part of dart.async;
2 abstract class Future<T> {static final _Future _nullFuture = ((__x10) => DEVC$R T.cast(__x10, DEVC$RT.type((Future<dynamic> _) { 2 abstract class Future<T> {static final _Future _nullFuture = ((__x9) => DEVC$RT .cast(__x9, DEVC$RT.type((Future<dynamic> _) {
3 } 3 }
4 ), DEVC$RT.type((_Future<dynamic> _) { 4 ), DEVC$RT.type((_Future<dynamic> _) {
5 } 5 }
6 ), "InferableAllocation", """line 98, column 38 of dart:async/future.dart: """, __x10 is _Future<dynamic>, true))(new Future.value(null)); 6 ), "InferableAllocation", """line 98, column 38 of dart:async/future.dart: """, __x9 is _Future<dynamic>, true))(new Future.value(null));
7 factory Future(computation()) { 7 factory Future(computation()) {
8 _Future result = new _Future<T>(); 8 _Future result = new _Future<T>();
9 Timer.run(() { 9 Timer.run(() {
10 try { 10 try {
11 result._complete(computation()); 11 result._complete(computation());
12 } 12 }
13 catch (e, s) { 13 catch (e, s) {
14 _completeWithErrorCallback(result, e, s); 14 _completeWithErrorCallback(result, e, s);
15 } 15 }
16 } 16 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 ); 130 );
131 } 131 }
132 if (remaining == 0 && !eagerError) { 132 if (remaining == 0 && !eagerError) {
133 result._completeError(error, stackTrace); 133 result._completeError(error, stackTrace);
134 } 134 }
135 } 135 }
136 } 136 }
137 , onError: handleError); 137 , onError: handleError);
138 } 138 }
139 if (remaining == 0) { 139 if (remaining == 0) {
140 return ((__x11) => DEVC$RT.cast(__x11, DEVC$RT.type((Future<dynamic> _) { 140 return new Future<List<dynamic>>.value(const []);
141 }
142 ), DEVC$RT.type((Future<List<dynamic>> _) {
143 }
144 ), "InferableAllocation", """line 313, column 14 of dart:async/future.dart: """, __x11 is Future<List<dynamic>>, false))(new Future.value(const []));
145 } 141 }
146 values = new List(remaining); 142 values = new List(remaining);
147 return result; 143 return result;
148 } 144 }
149 static Future forEach(Iterable input, f(element)) { 145 static Future forEach(Iterable input, f(element)) {
150 Iterator iterator = input.iterator; 146 Iterator iterator = input.iterator;
151 return doWhile(() { 147 return doWhile(() {
152 if (!iterator.moveNext()) return false; 148 if (!iterator.moveNext()) return false;
153 return new Future.sync(() => f(iterator.current)).then((_) => true); 149 return new Future.sync(() => f(iterator.current)).then((_) => true);
154 } 150 }
155 ); 151 );
156 } 152 }
157 static Future doWhile(f()) { 153 static Future doWhile(f()) {
158 _Future doneSignal = new _Future(); 154 _Future doneSignal = new _Future();
159 var nextIteration; 155 var nextIteration;
160 nextIteration = Zone.current.bindUnaryCallback((bool keepGoing) { 156 nextIteration = Zone.current.bindUnaryCallback((bool keepGoing) {
161 if (keepGoing) { 157 if (keepGoing) {
162 new Future.sync(f).then(DEVC$RT.cast(nextIteration, dynamic, __t12, "Dynam icCast", """line 361, column 33 of dart:async/future.dart: """, nextIteration is __t12, true), onError: doneSignal._completeError); 158 new Future.sync(f).then(DEVC$RT.cast(nextIteration, dynamic, __t10, "Dynam icCast", """line 361, column 33 of dart:async/future.dart: """, nextIteration is __t10, true), onError: doneSignal._completeError);
163 } 159 }
164 else { 160 else {
165 doneSignal._complete(null); 161 doneSignal._complete(null);
166 } 162 }
167 } 163 }
168 , runGuarded: true); 164 , runGuarded: true);
169 nextIteration(true); 165 nextIteration(true);
170 return doneSignal; 166 return doneSignal;
171 } 167 }
172 Future then(onValue(T value), { 168 Future then(onValue(T value), {
(...skipping 27 matching lines...) Expand all
200 } 196 }
201 void _completeWithErrorCallback(_Future result, error, stackTrace) { 197 void _completeWithErrorCallback(_Future result, error, stackTrace) {
202 AsyncError replacement = Zone.current.errorCallback(error, DEVC$RT.cast(stackTra ce, dynamic, StackTrace, "DynamicCast", """line 719, column 62 of dart:async/fut ure.dart: """, stackTrace is StackTrace, true)); 198 AsyncError replacement = Zone.current.errorCallback(error, DEVC$RT.cast(stackTra ce, dynamic, StackTrace, "DynamicCast", """line 719, column 62 of dart:async/fut ure.dart: """, stackTrace is StackTrace, true));
203 if (replacement != null) { 199 if (replacement != null) {
204 error = _nonNullError(replacement.error); 200 error = _nonNullError(replacement.error);
205 stackTrace = replacement.stackTrace; 201 stackTrace = replacement.stackTrace;
206 } 202 }
207 result._completeError(error, DEVC$RT.cast(stackTrace, dynamic, StackTrace, "Dyn amicCast", """line 724, column 32 of dart:async/future.dart: """, stackTrace is StackTrace, true)); 203 result._completeError(error, DEVC$RT.cast(stackTrace, dynamic, StackTrace, "Dyn amicCast", """line 724, column 32 of dart:async/future.dart: """, stackTrace is StackTrace, true));
208 } 204 }
209 Object _nonNullError(Object error) => (error != null) ? error : new NullThrownE rror(); 205 Object _nonNullError(Object error) => (error != null) ? error : new NullThrownE rror();
210 typedef dynamic __t12(dynamic __u13); 206 typedef dynamic __t10(dynamic __u11);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698