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

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

Issue 959003003: Typecheck constructor initializers properly (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Rebase Created 5 years, 10 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 dynamic c(T x0) => f(DDC$RT.cast(x0, dynamic, T, "CastParam", """line 208, colum n 46 of dart:async/future_impl.dart: """, x0 is T, false)); 105 dynamic c(T x0) => f(DDC$RT.cast(x0, dynamic, T, "CastParam", """line 208, colum n 46 of dart:async/future_impl.dart: """, x0 is T, false));
106 return f == null ? null : c; 106 return f == null ? null : c;
107 } 107 }
108 , f, DDC$RT.type((__t28<T> _) { 108 , f, DDC$RT.type((__t28<T> _) {
109 } 109 }
110 ), __t22, "Wrap", """line 208, column 46 of dart:async/future_impl.dart: """, f is __t22)); 110 ), __t22, "Wrap", """line 208, column 46 of dart:async/future_impl.dart: """, f is __t22));
111 if (onError != null) { 111 if (onError != null) {
112 onError = _registerErrorHandler(onError, result._zone); 112 onError = _registerErrorHandler(onError, result._zone);
113 } 113 }
114 } 114 }
115 _addListener(new _FutureListener.then(result, f, onError)); 115 _addListener(new _FutureListener.then(result, DDC$RT.wrap((dynamic f(T __u30)) {
116 dynamic c(T x0) => f(DDC$RT.cast(x0, dynamic, T, "CastParam", """line 213, colum n 51 of dart:async/future_impl.dart: """, x0 is T, false));
117 return f == null ? null : c;
118 }
119 , f, DDC$RT.type((__t28<T> _) {
120 }
121 ), __t22, "Wrap", """line 213, column 51 of dart:async/future_impl.dart: """, f is __t22), onError));
116 return result; 122 return result;
117 } 123 }
118 Future catchError(Function onError, { 124 Future catchError(Function onError, {
119 bool test(error)} 125 bool test(error)}
120 ) { 126 ) {
121 _Future result = new _Future(); 127 _Future result = new _Future();
122 if (!identical(result._zone, _ROOT_ZONE)) { 128 if (!identical(result._zone, _ROOT_ZONE)) {
123 onError = _registerErrorHandler(onError, result._zone); 129 onError = _registerErrorHandler(onError, result._zone);
124 if (test != null) test = ((__x32) => DDC$RT.wrap((dynamic f(dynamic __u31)) { 130 if (test != null) test = ((__x33) => DDC$RT.wrap((dynamic f(dynamic __u32)) {
125 dynamic c(dynamic x0) => ((__x30) => DDC$RT.cast(__x30, dynamic, bool, "CastResu lt", """line 221, column 32 of dart:async/future_impl.dart: """, __x30 is bool, true))(f(x0)); 131 dynamic c(dynamic x0) => ((__x31) => DDC$RT.cast(__x31, dynamic, bool, "CastResu lt", """line 221, column 32 of dart:async/future_impl.dart: """, __x31 is bool, true))(f(x0));
126 return f == null ? null : c; 132 return f == null ? null : c;
127 } 133 }
128 , __x32, __t22, __t24, "Wrap", """line 221, column 32 of dart:async/future_impl. dart: """, __x32 is __t24))(result._zone.registerUnaryCallback(test)); 134 , __x33, __t22, __t24, "Wrap", """line 221, column 32 of dart:async/future_impl. dart: """, __x33 is __t24))(result._zone.registerUnaryCallback(test));
129 } 135 }
130 _addListener(new _FutureListener.catchError(result, onError, test)); 136 _addListener(new _FutureListener.catchError(result, onError, test));
131 return result; 137 return result;
132 } 138 }
133 Future<T> whenComplete(action()) { 139 Future<T> whenComplete(action()) {
134 _Future result = new _Future<T>(); 140 _Future result = new _Future<T>();
135 if (!identical(result._zone, _ROOT_ZONE)) { 141 if (!identical(result._zone, _ROOT_ZONE)) {
136 action = result._zone.registerCallback(action); 142 action = result._zone.registerCallback(action);
137 } 143 }
138 _addListener(new _FutureListener.whenComplete(result, action)); 144 _addListener(new _FutureListener.whenComplete(result, action));
139 return DDC$RT.cast(result, DDC$RT.type((_Future<dynamic> _) { 145 return DDC$RT.cast(result, DDC$RT.type((_Future<dynamic> _) {
140 } 146 }
141 ), DDC$RT.type((Future<T> _) { 147 ), DDC$RT.type((Future<T> _) {
142 } 148 }
143 ), "CastDynamic", """line 233, column 12 of dart:async/future_impl.dart: """, re sult is Future<T>, false); 149 ), "CastDynamic", """line 233, column 12 of dart:async/future_impl.dart: """, re sult is Future<T>, false);
144 } 150 }
145 Stream<T> asStream() => ((__x33) => DDC$RT.cast(__x33, DDC$RT.type((Stream<dyna mic> _) { 151 Stream<T> asStream() => ((__x34) => DDC$RT.cast(__x34, DDC$RT.type((Stream<dyna mic> _) {
146 } 152 }
147 ), DDC$RT.type((Stream<T> _) { 153 ), DDC$RT.type((Stream<T> _) {
148 } 154 }
149 ), "CastExact", """line 236, column 27 of dart:async/future_impl.dart: """, __x3 3 is Stream<T>, false))(new Stream.fromFuture(this)); 155 ), "CastExact", """line 236, column 27 of dart:async/future_impl.dart: """, __x3 4 is Stream<T>, false))(new Stream.fromFuture(this));
150 void _markPendingCompletion() { 156 void _markPendingCompletion() {
151 if (!_mayComplete) throw new StateError("Future already completed"); 157 if (!_mayComplete) throw new StateError("Future already completed");
152 _state = _PENDING_COMPLETE; 158 _state = _PENDING_COMPLETE;
153 } 159 }
154 T get _value { 160 T get _value {
155 assert (_isComplete && _hasValue); return DDC$RT.cast(_resultOrListeners, dynami c, T, "CastGeneral", """line 245, column 12 of dart:async/future_impl.dart: """, _resultOrListeners is T, false); 161 assert (_isComplete && _hasValue); return DDC$RT.cast(_resultOrListeners, dynami c, T, "CastGeneral", """line 245, column 12 of dart:async/future_impl.dart: """, _resultOrListeners is T, false);
156 } 162 }
157 AsyncError get _error { 163 AsyncError get _error {
158 assert (_isComplete && _hasError); return DDC$RT.cast(_resultOrListeners, dynami c, AsyncError, "CastGeneral", """line 250, column 12 of dart:async/future_impl.d art: """, _resultOrListeners is AsyncError, true); 164 assert (_isComplete && _hasError); return DDC$RT.cast(_resultOrListeners, dynami c, AsyncError, "CastGeneral", """line 250, column 12 of dart:async/future_impl.d art: """, _resultOrListeners is AsyncError, true);
159 } 165 }
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 listenerValueOrError = new AsyncError(e, s); 330 listenerValueOrError = new AsyncError(e, s);
325 return false; 331 return false;
326 } 332 }
327 } 333 }
328 void handleError() { 334 void handleError() {
329 AsyncError asyncError = source._error; 335 AsyncError asyncError = source._error;
330 bool matchesTest = true; 336 bool matchesTest = true;
331 if (listener.hasErrorTest) { 337 if (listener.hasErrorTest) {
332 _FutureErrorTest test = listener._errorTest; 338 _FutureErrorTest test = listener._errorTest;
333 try { 339 try {
334 matchesTest = ((__x34) => DDC$RT.cast(__x34, dynamic, bool, "CastGeneral", " ""line 499, column 29 of dart:async/future_impl.dart: """, __x34 is bool, true)) (zone.runUnary(test, asyncError.error)); 340 matchesTest = ((__x35) => DDC$RT.cast(__x35, dynamic, bool, "CastGeneral", " ""line 499, column 29 of dart:async/future_impl.dart: """, __x35 is bool, true)) (zone.runUnary(test, asyncError.error));
335 } 341 }
336 catch (e, s) { 342 catch (e, s) {
337 listenerValueOrError = identical(asyncError.error, e) ? asyncError : new Asy ncError(e, s); 343 listenerValueOrError = identical(asyncError.error, e) ? asyncError : new Asy ncError(e, s);
338 listenerHasValue = false; 344 listenerHasValue = false;
339 return;} 345 return;}
340 } 346 }
341 Function errorCallback = listener._onError; 347 Function errorCallback = listener._onError;
342 if (matchesTest && errorCallback != null) { 348 if (matchesTest && errorCallback != null) {
343 try { 349 try {
344 if (errorCallback is ZoneBinaryCallback) { 350 if (errorCallback is ZoneBinaryCallback) {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 } 481 }
476 } 482 }
477 ); 483 );
478 return result; 484 return result;
479 } 485 }
480 } 486 }
481 typedef dynamic __t22(dynamic __u23); 487 typedef dynamic __t22(dynamic __u23);
482 typedef bool __t24(dynamic __u25); 488 typedef bool __t24(dynamic __u25);
483 typedef dynamic __t26(); 489 typedef dynamic __t26();
484 typedef dynamic __t28<T>(T __u29); 490 typedef dynamic __t28<T>(T __u29);
OLDNEW
« no previous file with comments | « test/dart_codegen/expect/_internal/list.dart ('k') | test/dart_codegen/expect/async/schedule_microtask.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698