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

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

Issue 12089066: Fix various warnings from the analyzer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | sdk/lib/core/date_time.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 // 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 // ------------------------------------------------------------------- 7 // -------------------------------------------------------------------
8 // Core Stream types 8 // Core Stream types
9 // ------------------------------------------------------------------- 9 // -------------------------------------------------------------------
10 10
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 * Finds the least element in the stream. 366 * Finds the least element in the stream.
367 * 367 *
368 * If the stream is empty, the result is [:null:]. 368 * If the stream is empty, the result is [:null:].
369 * Otherwise the result is a value from the stream that is not greater 369 * Otherwise the result is a value from the stream that is not greater
370 * than any other value from the stream (according to [compare], which must 370 * than any other value from the stream (according to [compare], which must
371 * be a [Comparator]). 371 * be a [Comparator]).
372 * 372 *
373 * If [compare] is omitted, it defaults to [Comparable.compare]. 373 * If [compare] is omitted, it defaults to [Comparable.compare].
374 */ 374 */
375 Future<T> min([int compare(T a, T b)]) { 375 Future<T> min([int compare(T a, T b)]) {
376 if (compare == null) compare = Comparable.compare; 376 if (compare == null) {
377 var defaultCompare = Comparable.compare;
378 compare = defaultCompare;
379 }
377 _FutureImpl<T> future = new _FutureImpl<T>(); 380 _FutureImpl<T> future = new _FutureImpl<T>();
378 StreamSubscription subscription; 381 StreamSubscription subscription;
379 T min = null; 382 T min = null;
380 subscription = this.listen( 383 subscription = this.listen(
381 // TODO(ahe): Restore type when feature is implemented in dart2js 384 // TODO(ahe): Restore type when feature is implemented in dart2js
382 // checked mode. http://dartbug.com/7733 385 // checked mode. http://dartbug.com/7733
383 (/*T*/ value) { 386 (/*T*/ value) {
384 min = value; 387 min = value;
385 subscription.onData((T value) { 388 subscription.onData((T value) {
386 _runUserCode( 389 _runUserCode(
(...skipping 20 matching lines...) Expand all
407 * Finds the largest element in the stream. 410 * Finds the largest element in the stream.
408 * 411 *
409 * If the stream is empty, the result is [:null:]. 412 * If the stream is empty, the result is [:null:].
410 * Otherwise the result is an value from the stream that is not smaller 413 * Otherwise the result is an value from the stream that is not smaller
411 * than any other value from the stream (according to [compare], which must 414 * than any other value from the stream (according to [compare], which must
412 * be a [Comparator]). 415 * be a [Comparator]).
413 * 416 *
414 * If [compare] is omitted, it defaults to [Comparable.compare]. 417 * If [compare] is omitted, it defaults to [Comparable.compare].
415 */ 418 */
416 Future<T> max([int compare(T a, T b)]) { 419 Future<T> max([int compare(T a, T b)]) {
417 if (compare == null) compare = Comparable.compare; 420 if (compare == null) {
421 var defaultCompare = Comparable.compare;
422 compare = defaultCompare;
423 }
418 _FutureImpl<T> future = new _FutureImpl<T>(); 424 _FutureImpl<T> future = new _FutureImpl<T>();
419 StreamSubscription subscription; 425 StreamSubscription subscription;
420 T max = null; 426 T max = null;
421 subscription = this.listen( 427 subscription = this.listen(
422 // TODO(ahe): Restore type when feature is implemented in dart2js 428 // TODO(ahe): Restore type when feature is implemented in dart2js
423 // checked mode. http://dartbug.com/7733 429 // checked mode. http://dartbug.com/7733
424 (/*T*/ value) { 430 (/*T*/ value) {
425 max = value; 431 max = value;
426 subscription.onData((T value) { 432 subscription.onData((T value) {
427 _runUserCode( 433 _runUserCode(
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 } 1131 }
1126 1132
1127 class _StreamOutputSinkWrapper<T> implements StreamSink<T> { 1133 class _StreamOutputSinkWrapper<T> implements StreamSink<T> {
1128 _StreamOutputSink _sink; 1134 _StreamOutputSink _sink;
1129 _StreamOutputSinkWrapper(this._sink); 1135 _StreamOutputSinkWrapper(this._sink);
1130 1136
1131 void add(T data) => _sink._sendData(data); 1137 void add(T data) => _sink._sendData(data);
1132 void signalError(AsyncError error) => _sink._sendError(error); 1138 void signalError(AsyncError error) => _sink._sendError(error);
1133 void close() => _sink._sendDone(); 1139 void close() => _sink._sendDone();
1134 } 1140 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/core/date_time.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698