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

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: Rebase 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 = new Future.value(n ull);
3 }
4 ), DEVC$RT.type((_Future<dynamic> _) {
5 }
6 ), "InferableAllocation", """line 98, column 38 of dart:async/future.dart: """, __x10 is _Future<dynamic>, true))(new Future.value(null));
7 factory Future(computation()) { 3 factory Future(computation()) {
8 _Future result = new _Future<T>(); 4 _Future result = new _Future<T>();
9 Timer.run(() { 5 Timer.run(() {
10 try { 6 try {
11 result._complete(computation()); 7 result._complete(computation());
12 } 8 }
13 catch (e, s) { 9 catch (e, s) {
14 _completeWithErrorCallback(result, e, s); 10 _completeWithErrorCallback(result, e, s);
15 } 11 }
16 } 12 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 ); 126 );
131 } 127 }
132 if (remaining == 0 && !eagerError) { 128 if (remaining == 0 && !eagerError) {
133 result._completeError(error, stackTrace); 129 result._completeError(error, stackTrace);
134 } 130 }
135 } 131 }
136 } 132 }
137 , onError: handleError); 133 , onError: handleError);
138 } 134 }
139 if (remaining == 0) { 135 if (remaining == 0) {
140 return ((__x11) => DEVC$RT.cast(__x11, DEVC$RT.type((Future<dynamic> _) { 136 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 } 137 }
146 values = new List(remaining); 138 values = new List(remaining);
147 return result; 139 return result;
148 } 140 }
149 static Future forEach(Iterable input, f(element)) { 141 static Future forEach(Iterable input, f(element)) {
150 Iterator iterator = input.iterator; 142 Iterator iterator = input.iterator;
151 return doWhile(() { 143 return doWhile(() {
152 if (!iterator.moveNext()) return false; 144 if (!iterator.moveNext()) return false;
153 return new Future.sync(() => f(iterator.current)).then((_) => true); 145 return new Future.sync(() => f(iterator.current)).then((_) => true);
154 } 146 }
155 ); 147 );
156 } 148 }
157 static Future doWhile(f()) { 149 static Future doWhile(f()) {
158 _Future doneSignal = new _Future(); 150 _Future doneSignal = new _Future();
159 var nextIteration; 151 var nextIteration;
160 nextIteration = Zone.current.bindUnaryCallback((bool keepGoing) { 152 nextIteration = Zone.current.bindUnaryCallback((bool keepGoing) {
161 if (keepGoing) { 153 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); 154 new Future.sync(f).then(DEVC$RT.cast(nextIteration, dynamic, __t9, "Dynami cCast", """line 361, column 33 of dart:async/future.dart: """, nextIteration is __t9, true), onError: doneSignal._completeError);
163 } 155 }
164 else { 156 else {
165 doneSignal._complete(null); 157 doneSignal._complete(null);
166 } 158 }
167 } 159 }
168 , runGuarded: true); 160 , runGuarded: true);
169 nextIteration(true); 161 nextIteration(true);
170 return doneSignal; 162 return doneSignal;
171 } 163 }
172 Future then(onValue(T value), { 164 Future then(onValue(T value), {
(...skipping 27 matching lines...) Expand all
200 } 192 }
201 void _completeWithErrorCallback(_Future result, error, stackTrace) { 193 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)); 194 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) { 195 if (replacement != null) {
204 error = _nonNullError(replacement.error); 196 error = _nonNullError(replacement.error);
205 stackTrace = replacement.stackTrace; 197 stackTrace = replacement.stackTrace;
206 } 198 }
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)); 199 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 } 200 }
209 Object _nonNullError(Object error) => (error != null) ? error : new NullThrownE rror(); 201 Object _nonNullError(Object error) => (error != null) ? error : new NullThrownE rror();
210 typedef dynamic __t12(dynamic __u13); 202 typedef dynamic __t9(dynamic __u10);
OLDNEW
« no previous file with comments | « test/dart_codegen/expect/async/broadcast_stream_controller.dart ('k') | test/dart_codegen/expect/async/future_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698