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

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

Issue 1010893004: Allow S->T <: dynamic->T (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Rebase and address comments 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 = ((__x10) => DEVC$R T.cast(__x10, DEVC$RT.type((Future<dynamic> _) {
3 } 3 }
4 ), DEVC$RT.type((_Future<dynamic> _) { 4 ), DEVC$RT.type((_Future<dynamic> _) {
5 } 5 }
6 ), "CastExact", """line 98, column 38 of dart:async/future.dart: """, __x10 is _ Future<dynamic>, true))(new Future.value(null)); 6 ), "CastExact", """line 98, column 38 of dart:async/future.dart: """, __x10 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 {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 error = theError; 107 error = theError;
108 stackTrace = DEVC$RT.cast(theStackTrace, dynamic, StackTrace, "CastGene ral", """line 283, column 24 of dart:async/future.dart: """, theStackTrace is St ackTrace, true); 108 stackTrace = DEVC$RT.cast(theStackTrace, dynamic, StackTrace, "CastGene ral", """line 283, column 24 of dart:async/future.dart: """, theStackTrace is St ackTrace, true);
109 } 109 }
110 } 110 }
111 else if (remaining == 0 && !eagerError) { 111 else if (remaining == 0 && !eagerError) {
112 result._completeError(error, stackTrace); 112 result._completeError(error, stackTrace);
113 } 113 }
114 } 114 }
115 for (Future future in futures) { 115 for (Future future in futures) {
116 int pos = remaining++; 116 int pos = remaining++;
117 future.then(((__x16) => DEVC$RT.wrap((dynamic f(Object __u11)) { 117 future.then((Object value) {
118 dynamic c(Object x0) => f(x0);
119 return f == null ? null : c;
120 }
121 , __x16, __t14, __t12, "WrapLiteral", """line 294, column 19 of dart:async/f uture.dart: """, __x16 is __t12))((Object value) {
122 remaining--; 118 remaining--;
123 if (values != null) { 119 if (values != null) {
124 values[pos] = value; 120 values[pos] = value;
125 if (remaining == 0) { 121 if (remaining == 0) {
126 result._completeWithValue(values); 122 result._completeWithValue(values);
127 } 123 }
128 } 124 }
129 else { 125 else {
130 if (cleanUp != null && value != null) { 126 if (cleanUp != null && value != null) {
131 new Future.sync(() { 127 new Future.sync(() {
132 cleanUp(value); 128 cleanUp(value);
133 } 129 }
134 ); 130 );
135 } 131 }
136 if (remaining == 0 && !eagerError) { 132 if (remaining == 0 && !eagerError) {
137 result._completeError(error, stackTrace); 133 result._completeError(error, stackTrace);
138 } 134 }
139 } 135 }
140 } 136 }
141 ), onError: handleError); 137 , onError: handleError);
142 } 138 }
143 if (remaining == 0) { 139 if (remaining == 0) {
144 return ((__x17) => DEVC$RT.cast(__x17, DEVC$RT.type((Future<dynamic> _) { 140 return ((__x11) => DEVC$RT.cast(__x11, DEVC$RT.type((Future<dynamic> _) {
145 } 141 }
146 ), DEVC$RT.type((Future<List<dynamic>> _) { 142 ), DEVC$RT.type((Future<List<dynamic>> _) {
147 } 143 }
148 ), "CastExact", """line 313, column 14 of dart:async/future.dart: """, __x17 is Future<List<dynamic>>, false))(new Future.value(const [])); 144 ), "CastExact", """line 313, column 14 of dart:async/future.dart: """, __x11 is Future<List<dynamic>>, false))(new Future.value(const []));
149 } 145 }
150 values = new List(remaining); 146 values = new List(remaining);
151 return result; 147 return result;
152 } 148 }
153 static Future forEach(Iterable input, f(element)) { 149 static Future forEach(Iterable input, f(element)) {
154 Iterator iterator = input.iterator; 150 Iterator iterator = input.iterator;
155 return doWhile(() { 151 return doWhile(() {
156 if (!iterator.moveNext()) return false; 152 if (!iterator.moveNext()) return false;
157 return new Future.sync(() => f(iterator.current)).then((_) => true); 153 return new Future.sync(() => f(iterator.current)).then((_) => true);
158 } 154 }
159 ); 155 );
160 } 156 }
161 static Future doWhile(f()) { 157 static Future doWhile(f()) {
162 _Future doneSignal = new _Future(); 158 _Future doneSignal = new _Future();
163 var nextIteration; 159 var nextIteration;
164 nextIteration = Zone.current.bindUnaryCallback(((__x21) => DEVC$RT.wrap((dyna mic f(bool __u18)) { 160 nextIteration = Zone.current.bindUnaryCallback((bool keepGoing) {
165 dynamic c(bool x0) => f(DEVC$RT.cast(x0, dynamic, bool, "CastParam", """line 359, column 52 of dart:async/future.dart: """, x0 is bool, true));
166 return f == null ? null : c;
167 }
168 , __x21, __t19, __t12, "WrapLiteral", """line 359, column 52 of dart:async/fut ure.dart: """, __x21 is __t12))((bool keepGoing) {
169 if (keepGoing) { 161 if (keepGoing) {
170 new Future.sync(f).then(DEVC$RT.cast(nextIteration, dynamic, __t12, "CastG eneral", """line 361, column 33 of dart:async/future.dart: """, nextIteration is __t12, false), onError: doneSignal._completeError); 162 new Future.sync(f).then(DEVC$RT.cast(nextIteration, dynamic, __t12, "CastG eneral", """line 361, column 33 of dart:async/future.dart: """, nextIteration is __t12, false), onError: doneSignal._completeError);
171 } 163 }
172 else { 164 else {
173 doneSignal._complete(null); 165 doneSignal._complete(null);
174 } 166 }
175 } 167 }
176 ), runGuarded: true); 168 , runGuarded: true);
177 nextIteration(true); 169 nextIteration(true);
178 return doneSignal; 170 return doneSignal;
179 } 171 }
180 Future then(onValue(T value), { 172 Future then(onValue(T value), {
181 Function onError} 173 Function onError}
182 ); 174 );
183 Future catchError(Function onError, { 175 Future catchError(Function onError, {
184 bool test(Object error)} 176 bool test(Object error)}
185 ); 177 );
186 Future<T> whenComplete(action()); 178 Future<T> whenComplete(action());
(...skipping 22 matching lines...) Expand all
209 void _completeWithErrorCallback(_Future result, error, stackTrace) { 201 void _completeWithErrorCallback(_Future result, error, stackTrace) {
210 AsyncError replacement = Zone.current.errorCallback(error, DEVC$RT.cast(stackTra ce, dynamic, StackTrace, "CastGeneral", """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, "CastGeneral", """line 719, column 62 of dart:async/fut ure.dart: """, stackTrace is StackTrace, true));
211 if (replacement != null) { 203 if (replacement != null) {
212 error = _nonNullError(replacement.error); 204 error = _nonNullError(replacement.error);
213 stackTrace = replacement.stackTrace; 205 stackTrace = replacement.stackTrace;
214 } 206 }
215 result._completeError(error, DEVC$RT.cast(stackTrace, dynamic, StackTrace, "Cas tGeneral", """line 724, column 32 of dart:async/future.dart: """, stackTrace is StackTrace, true)); 207 result._completeError(error, DEVC$RT.cast(stackTrace, dynamic, StackTrace, "Cas tGeneral", """line 724, column 32 of dart:async/future.dart: """, stackTrace is StackTrace, true));
216 } 208 }
217 Object _nonNullError(Object error) => (error != null) ? error : new NullThrownE rror(); 209 Object _nonNullError(Object error) => (error != null) ? error : new NullThrownE rror();
218 typedef dynamic __t12(dynamic __u13); 210 typedef dynamic __t12(dynamic __u13);
219 typedef dynamic __t14(Object __u15);
220 typedef dynamic __t19(bool __u20);
OLDNEW
« no previous file with comments | « test/dart_codegen/expect/_internal/iterable.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