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

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: Small fixes Created 5 years, 9 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 ((__x10) => DEVC$RT.cast(__x10, DEVC$RT.type((Future<dynamic> _) {
141 } 141 }
142 ), DEVC$RT.type((Future<List<dynamic>> _) { 142 ), DEVC$RT.type((Future<List<dynamic>> _) {
143 } 143 }
144 ), "InferableAllocation", """line 313, column 14 of dart:async/future.dart: """, __x11 is Future<List<dynamic>>, false))(new Future.value(const [])); 144 ), "InferableAllocation", """line 313, column 14 of dart:async/future.dart: """, __x10 is Future<List<dynamic>>, false))(new Future.value(const []));
145 } 145 }
146 values = new List(remaining); 146 values = new List(remaining);
147 return result; 147 return result;
148 } 148 }
149 static Future forEach(Iterable input, f(element)) { 149 static Future forEach(Iterable input, f(element)) {
150 Iterator iterator = input.iterator; 150 Iterator iterator = input.iterator;
151 return doWhile(() { 151 return doWhile(() {
152 if (!iterator.moveNext()) return false; 152 if (!iterator.moveNext()) return false;
153 return new Future.sync(() => f(iterator.current)).then((_) => true); 153 return new Future.sync(() => f(iterator.current)).then((_) => true);
154 } 154 }
155 ); 155 );
156 } 156 }
157 static Future doWhile(f()) { 157 static Future doWhile(f()) {
158 _Future doneSignal = new _Future(); 158 _Future doneSignal = new _Future();
159 var nextIteration; 159 var nextIteration;
160 nextIteration = Zone.current.bindUnaryCallback((bool keepGoing) { 160 nextIteration = Zone.current.bindUnaryCallback((bool keepGoing) {
161 if (keepGoing) { 161 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); 162 new Future.sync(f).then(DEVC$RT.cast(nextIteration, dynamic, __t11, "Dynam icCast", """line 361, column 33 of dart:async/future.dart: """, nextIteration is __t11, true), onError: doneSignal._completeError);
163 } 163 }
164 else { 164 else {
165 doneSignal._complete(null); 165 doneSignal._complete(null);
166 } 166 }
167 } 167 }
168 , runGuarded: true); 168 , runGuarded: true);
169 nextIteration(true); 169 nextIteration(true);
170 return doneSignal; 170 return doneSignal;
171 } 171 }
172 Future then(onValue(T value), { 172 Future then(onValue(T value), {
(...skipping 27 matching lines...) Expand all
200 } 200 }
201 void _completeWithErrorCallback(_Future result, error, stackTrace) { 201 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)); 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));
203 if (replacement != null) { 203 if (replacement != null) {
204 error = _nonNullError(replacement.error); 204 error = _nonNullError(replacement.error);
205 stackTrace = replacement.stackTrace; 205 stackTrace = replacement.stackTrace;
206 } 206 }
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)); 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));
208 } 208 }
209 Object _nonNullError(Object error) => (error != null) ? error : new NullThrownE rror(); 209 Object _nonNullError(Object error) => (error != null) ? error : new NullThrownE rror();
210 typedef dynamic __t12(dynamic __u13); 210 typedef dynamic __t11(dynamic __u12);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698