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

Side by Side Diff: sdk/lib/async/future_impl.dart

Issue 3009893002: Avoid relying on fuzzy arrow for arity check in _FutureListener (Closed)
Patch Set: Created 3 years, 3 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.async; 5 part of dart.async;
6 6
7 /** The onValue and onError handlers return either a value or a future */ 7 /** The onValue and onError handlers return either a value or a future */
8 typedef FutureOr<T> _FutureOnValue<S, T>(S value); 8 typedef FutureOr<T> _FutureOnValue<S, T>(S value);
9 /** Test used by [Future.catchError] to handle skip some errors. */ 9 /** Test used by [Future.catchError] to handle skip some errors. */
10 typedef bool _FutureErrorTest(Object error); 10 typedef bool _FutureErrorTest(Object error);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 return _zone.runUnary<FutureOr<T>, S>(_onValue, sourceResult); 129 return _zone.runUnary<FutureOr<T>, S>(_onValue, sourceResult);
130 } 130 }
131 131
132 bool matchesErrorTest(AsyncError asyncError) { 132 bool matchesErrorTest(AsyncError asyncError) {
133 if (!hasErrorTest) return true; 133 if (!hasErrorTest) return true;
134 return _zone.runUnary<bool, Object>(_errorTest, asyncError.error); 134 return _zone.runUnary<bool, Object>(_errorTest, asyncError.error);
135 } 135 }
136 136
137 FutureOr<T> handleError(AsyncError asyncError) { 137 FutureOr<T> handleError(AsyncError asyncError) {
138 assert(handlesError && hasErrorCallback); 138 assert(handlesError && hasErrorCallback);
139 if (errorCallback is ZoneBinaryCallback) { 139 if (errorCallback is ZoneBinaryCallback<dynamic, Null, Null>) {
floitsch 2017/08/31 07:54:52 Might as well use the correct type (see 2 lines be
140 var typedErrorCallback = errorCallback as Object 140 var typedErrorCallback = errorCallback as Object
141 /*=ZoneBinaryCallback<FutureOr<T>, Object, StackTrace>*/; 141 /*=ZoneBinaryCallback<FutureOr<T>, Object, StackTrace>*/;
142 return _zone.runBinary( 142 return _zone.runBinary(
143 typedErrorCallback, asyncError.error, asyncError.stackTrace); 143 typedErrorCallback, asyncError.error, asyncError.stackTrace);
144 } else { 144 } else {
145 return _zone.runUnary<FutureOr<T>, Object>( 145 return _zone.runUnary<FutureOr<T>, Object>(
146 errorCallback, asyncError.error); 146 errorCallback, asyncError.error);
147 } 147 }
148 } 148 }
149 149
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 } 735 }
736 }, onError: (e, s) { 736 }, onError: (e, s) {
737 if (timer.isActive) { 737 if (timer.isActive) {
738 timer.cancel(); 738 timer.cancel();
739 result._completeError(e, s); 739 result._completeError(e, s);
740 } 740 }
741 }); 741 });
742 return result; 742 return result;
743 } 743 }
744 } 744 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698