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

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

Issue 1021273004: Allow arity checks on dynamic function types (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Address jacobr's 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 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 _FutureListener.then(this.result, _FutureOnValue onValue, Function errorCallbac k) : callback = onValue, errorCallback = errorCallback, state = (errorCallback = = null) ? STATE_THEN : STATE_THEN_ONERROR; 51 _FutureListener.then(this.result, _FutureOnValue onValue, Function errorCallbac k) : callback = onValue, errorCallback = errorCallback, state = (errorCallback = = null) ? STATE_THEN : STATE_THEN_ONERROR;
52 _FutureListener.catchError(this.result, this.errorCallback, _FutureErrorTest te st) : callback = test, state = (test == null) ? STATE_CATCHERROR : STATE_CATCHER ROR_TEST; 52 _FutureListener.catchError(this.result, this.errorCallback, _FutureErrorTest te st) : callback = test, state = (test == null) ? STATE_CATCHERROR : STATE_CATCHER ROR_TEST;
53 _FutureListener.whenComplete(this.result, _FutureAction onComplete) : callback = onComplete, errorCallback = null, state = STATE_WHENCOMPLETE; 53 _FutureListener.whenComplete(this.result, _FutureAction onComplete) : callback = onComplete, errorCallback = null, state = STATE_WHENCOMPLETE;
54 _FutureListener.chain(this.result) : callback = null, errorCallback = null, sta te = STATE_CHAIN; 54 _FutureListener.chain(this.result) : callback = null, errorCallback = null, sta te = STATE_CHAIN;
55 Zone get _zone => result._zone; 55 Zone get _zone => result._zone;
56 bool get handlesValue => (state & MASK_VALUE != 0); 56 bool get handlesValue => (state & MASK_VALUE != 0);
57 bool get handlesError => (state & MASK_ERROR != 0); 57 bool get handlesError => (state & MASK_ERROR != 0);
58 bool get hasErrorTest => (state == STATE_CATCHERROR_TEST); 58 bool get hasErrorTest => (state == STATE_CATCHERROR_TEST);
59 bool get handlesComplete => (state == STATE_WHENCOMPLETE); 59 bool get handlesComplete => (state == STATE_WHENCOMPLETE);
60 _FutureOnValue get _onValue { 60 _FutureOnValue get _onValue {
61 assert (handlesValue); return DEVC$RT.cast(callback, Function, __t14, "CastGener al", """line 112, column 12 of dart:async/future_impl.dart: """, callback is __t 14, false); 61 assert (handlesValue); return DEVC$RT.cast(callback, Function, __t14, "CastGener al", """line 112, column 12 of dart:async/future_impl.dart: """, callback is __t 14, true);
62 } 62 }
63 Function get _onError => errorCallback; 63 Function get _onError => errorCallback;
64 _FutureErrorTest get _errorTest { 64 _FutureErrorTest get _errorTest {
65 assert (hasErrorTest); return DEVC$RT.cast(callback, Function, __t16, "CastGener al", """line 117, column 12 of dart:async/future_impl.dart: """, callback is __t 16, false); 65 assert (hasErrorTest); return DEVC$RT.cast(callback, Function, __t16, "CastGener al", """line 117, column 12 of dart:async/future_impl.dart: """, callback is __t 16, false);
66 } 66 }
67 _FutureAction get _whenCompleteAction { 67 _FutureAction get _whenCompleteAction {
68 assert (handlesComplete); return DEVC$RT.cast(callback, Function, __t18, "CastGe neral", """line 121, column 12 of dart:async/future_impl.dart: """, callback is __t18, false); 68 assert (handlesComplete); return DEVC$RT.cast(callback, Function, __t18, "CastGe neral", """line 121, column 12 of dart:async/future_impl.dart: """, callback is __t18, true);
69 } 69 }
70 } 70 }
71 class _Future<T> implements Future<T> {static const int _INCOMPLETE = 0; 71 class _Future<T> implements Future<T> {static const int _INCOMPLETE = 0;
72 static const int _PENDING_COMPLETE = 1; 72 static const int _PENDING_COMPLETE = 1;
73 static const int _CHAINED = 2; 73 static const int _CHAINED = 2;
74 static const int _VALUE = 4; 74 static const int _VALUE = 4;
75 static const int _ERROR = 8; 75 static const int _ERROR = 8;
76 int _state = _INCOMPLETE; 76 int _state = _INCOMPLETE;
77 final Zone _zone = Zone.current; 77 final Zone _zone = Zone.current;
78 var _resultOrListeners; 78 var _resultOrListeners;
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 listenerHasValue = false; 338 listenerHasValue = false;
339 return;} 339 return;}
340 } 340 }
341 Function errorCallback = listener._onError; 341 Function errorCallback = listener._onError;
342 if (matchesTest && errorCallback != null) { 342 if (matchesTest && errorCallback != null) {
343 try { 343 try {
344 if (errorCallback is ZoneBinaryCallback) { 344 if (errorCallback is ZoneBinaryCallback) {
345 listenerValueOrError = zone.runBinary(errorCallback, asyncError.error, asy ncError.stackTrace); 345 listenerValueOrError = zone.runBinary(errorCallback, asyncError.error, asy ncError.stackTrace);
346 } 346 }
347 else { 347 else {
348 listenerValueOrError = zone.runUnary(DEVC$RT.cast(errorCallback, Function, __t14, "CastGeneral", """line 515, column 54 of dart:async/future_impl.dart: "" ", errorCallback is __t14, false), asyncError.error); 348 listenerValueOrError = zone.runUnary(DEVC$RT.cast(errorCallback, Function, __t14, "CastGeneral", """line 515, column 54 of dart:async/future_impl.dart: "" ", errorCallback is __t14, true), asyncError.error);
349 } 349 }
350 } 350 }
351 catch (e, s) { 351 catch (e, s) {
352 listenerValueOrError = identical(asyncError.error, e) ? asyncError : new Asy ncError(e, s); 352 listenerValueOrError = identical(asyncError.error, e) ? asyncError : new Asy ncError(e, s);
353 listenerHasValue = false; 353 listenerHasValue = false;
354 return;} 354 return;}
355 listenerHasValue = true; 355 listenerHasValue = true;
356 } 356 }
357 else { 357 else {
358 listenerValueOrError = asyncError; 358 listenerValueOrError = asyncError;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 } 475 }
476 } 476 }
477 ); 477 );
478 return result; 478 return result;
479 } 479 }
480 } 480 }
481 typedef dynamic __t14(dynamic __u15); 481 typedef dynamic __t14(dynamic __u15);
482 typedef bool __t16(dynamic __u17); 482 typedef bool __t16(dynamic __u17);
483 typedef dynamic __t18(); 483 typedef dynamic __t18();
484 typedef dynamic __t20<T>(T __u21); 484 typedef dynamic __t20<T>(T __u21);
OLDNEW
« no previous file with comments | « test/dart_codegen/expect/async/future.dart ('k') | test/dart_codegen/expect/async/stream_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698