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

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

Issue 1096583002: Reifier hookup (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
« no previous file with comments | « test/dart_codegen/expect/async/future.dart ('k') | test/dart_codegen/expect/async/stream.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 part of dart.async; 1 part of dart.async;
2 typedef dynamic _FutureOnValue<T>(T value); 2 typedef dynamic _FutureOnValue<T>(T value);
3 typedef bool _FutureErrorTest(var error); 3 typedef bool _FutureErrorTest(var error);
4 typedef _FutureAction(); 4 typedef _FutureAction();
5 abstract class _Completer<T> implements Completer<T> {final _Future<T> future = new _Future<T>(); 5 abstract class _Completer<T> implements Completer<T> {final _Future<T> future = new _Future<T>();
6 void complete([value]); 6 void complete([value]);
7 void completeError(Object error, [StackTrace stackTrace]) { 7 void completeError(Object error, [StackTrace stackTrace]) {
8 error = _nonNullError(error); 8 error = _nonNullError(error);
9 if (!future._mayComplete) throw new StateError("Future already completed"); 9 if (!future._mayComplete) throw new StateError("Future already completed");
10 AsyncError replacement = Zone.current.errorCallback(error, stackTrace); 10 AsyncError replacement = Zone.current.errorCallback(error, stackTrace);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 } 96 }
97 else { 97 else {
98 assert (_isChained); _state = _INCOMPLETE; 98 assert (_isChained); _state = _INCOMPLETE;
99 } 99 }
100 } 100 }
101 Future then(f(T value), { 101 Future then(f(T value), {
102 Function onError} 102 Function onError}
103 ) { 103 ) {
104 _Future result = new _Future(); 104 _Future result = new _Future();
105 if (!identical(result._zone, _ROOT_ZONE)) { 105 if (!identical(result._zone, _ROOT_ZONE)) {
106 f = ((__x12) => DEVC$RT.cast(__x12, ZoneUnaryCallback, DEVC$RT.type((__t10<T> _) { 106 f = ((__x12) => DEVC$RT.cast(__x12, ZoneUnaryCallback, DEVC$RT.type((__CastType1 0<T> _) {
107 } 107 }
108 ), "CompositeCast", """line 208, column 11 of dart:async/future_impl.dart: """, __x12 is __t10<T>, false))(result._zone.registerUnaryCallback(f)); 108 ), "CompositeCast", """line 208, column 11 of dart:async/future_impl.dart: """, __x12 is __CastType10<T>, false))(result._zone.registerUnaryCallback(f));
109 if (onError != null) { 109 if (onError != null) {
110 onError = _registerErrorHandler(onError, result._zone); 110 onError = _registerErrorHandler(onError, result._zone);
111 } 111 }
112 } 112 }
113 _addListener(new _FutureListener.then(result, f, onError)); 113 _addListener(new _FutureListener.then(result, f, onError));
114 return result; 114 return result;
115 } 115 }
116 Future catchError(Function onError, { 116 Future catchError(Function onError, {
117 bool test(error)} 117 bool test(error)}
118 ) { 118 ) {
119 _Future result = new _Future(); 119 _Future result = new _Future();
120 if (!identical(result._zone, _ROOT_ZONE)) { 120 if (!identical(result._zone, _ROOT_ZONE)) {
121 onError = _registerErrorHandler(onError, result._zone); 121 onError = _registerErrorHandler(onError, result._zone);
122 if (test != null) test = ((__x15) => DEVC$RT.cast(__x15, ZoneUnaryCallback, __t 13, "CompositeCast", """line 221, column 32 of dart:async/future_impl.dart: """, __x15 is __t13, false))(result._zone.registerUnaryCallback(test)); 122 if (test != null) test = ((__x15) => DEVC$RT.cast(__x15, ZoneUnaryCallback, __C astType13, "CompositeCast", """line 221, column 32 of dart:async/future_impl.dar t: """, __x15 is __CastType13, false))(result._zone.registerUnaryCallback(test)) ;
123 } 123 }
124 _addListener(new _FutureListener.catchError(result, onError, test)); 124 _addListener(new _FutureListener.catchError(result, onError, test));
125 return result; 125 return result;
126 } 126 }
127 Future<T> whenComplete(action()) { 127 Future<T> whenComplete(action()) {
128 _Future result = new _Future<T>(); 128 _Future result = new _Future<T>();
129 if (!identical(result._zone, _ROOT_ZONE)) { 129 if (!identical(result._zone, _ROOT_ZONE)) {
130 action = result._zone.registerCallback(action); 130 action = result._zone.registerCallback(action);
131 } 131 }
132 _addListener(new _FutureListener.whenComplete(result, action)); 132 _addListener(new _FutureListener.whenComplete(result, action));
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 listenerHasValue = false; 328 listenerHasValue = false;
329 return;} 329 return;}
330 } 330 }
331 Function errorCallback = listener._onError; 331 Function errorCallback = listener._onError;
332 if (matchesTest && errorCallback != null) { 332 if (matchesTest && errorCallback != null) {
333 try { 333 try {
334 if (errorCallback is ZoneBinaryCallback) { 334 if (errorCallback is ZoneBinaryCallback) {
335 listenerValueOrError = zone.runBinary(errorCallback, asyncError.error, asy ncError.stackTrace); 335 listenerValueOrError = zone.runBinary(errorCallback, asyncError.error, asy ncError.stackTrace);
336 } 336 }
337 else { 337 else {
338 listenerValueOrError = zone.runUnary(DEVC$RT.cast(errorCallback, Function, __t17, "ImplicitCast", """line 515, column 54 of dart:async/future_impl.dart: " "", errorCallback is __t17, true), asyncError.error); 338 listenerValueOrError = zone.runUnary(DEVC$RT.cast(errorCallback, Function, __CastType17, "ImplicitCast", """line 515, column 54 of dart:async/future_impl. dart: """, errorCallback is __CastType17, true), asyncError.error);
339 } 339 }
340 } 340 }
341 catch (e, s) { 341 catch (e, s) {
342 listenerValueOrError = identical(asyncError.error, e) ? asyncError : new Asy ncError(e, s); 342 listenerValueOrError = identical(asyncError.error, e) ? asyncError : new Asy ncError(e, s);
343 listenerHasValue = false; 343 listenerHasValue = false;
344 return;} 344 return;}
345 listenerHasValue = true; 345 listenerHasValue = true;
346 } 346 }
347 else { 347 else {
348 listenerValueOrError = asyncError; 348 listenerValueOrError = asyncError;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 , onError: (e, s) { 461 , onError: (e, s) {
462 if (timer.isActive) { 462 if (timer.isActive) {
463 timer.cancel(); 463 timer.cancel();
464 result._completeError(e, DEVC$RT.cast(s, dynamic, StackTrace, "DynamicCast", "" "line 646, column 34 of dart:async/future_impl.dart: """, s is StackTrace, true) ); 464 result._completeError(e, DEVC$RT.cast(s, dynamic, StackTrace, "DynamicCast", "" "line 646, column 34 of dart:async/future_impl.dart: """, s is StackTrace, true) );
465 } 465 }
466 } 466 }
467 ); 467 );
468 return result; 468 return result;
469 } 469 }
470 } 470 }
471 typedef dynamic __t10<T>(T __u11); 471 typedef dynamic __CastType10<T>(T __u11);
472 typedef bool __t13(dynamic __u14); 472 typedef bool __CastType13(dynamic __u14);
473 typedef dynamic __t17(dynamic __u18); 473 typedef dynamic __CastType17(dynamic __u18);
OLDNEW
« no previous file with comments | « test/dart_codegen/expect/async/future.dart ('k') | test/dart_codegen/expect/async/stream.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698