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

Unified Diff: lib/src/typed/stream.dart

Issue 2660333005: Change generic comment syntax to real generic syntax. (Closed)
Patch Set: Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: lib/src/typed/stream.dart
diff --git a/lib/src/typed/stream.dart b/lib/src/typed/stream.dart
index afa4462d9a019f0f6843ac1938e69e0d8a5fc06d..8884072f86e2a12c56a528d5c121a1281dda9e95 100644
--- a/lib/src/typed/stream.dart
+++ b/lib/src/typed/stream.dart
@@ -30,29 +30,28 @@ class TypeSafeStream<T> implements Stream<T> {
onListen: onListen == null
? null
: (subscription) =>
- onListen(new TypeSafeStreamSubscription<T>(subscription)),
+ onListen(new TypeSafeStreamSubscription<T>(subscription)),
onCancel: onCancel == null
? null
: (subscription) =>
- onCancel(new TypeSafeStreamSubscription<T>(subscription))));
+ onCancel(new TypeSafeStreamSubscription<T>(subscription))));
}
- Stream/*<E>*/ asyncExpand/*<E>*/(Stream/*<E>*/ convert(T event)) =>
- _stream.asyncExpand(_validateType(convert));
+ Stream<E> asyncExpand<E>(Stream<E> convert(T event)) => _stream
+ .asyncExpand(_validateType(convert));
- Stream/*<E>*/ asyncMap/*<E>*/(convert(T event)) =>
- _stream.asyncMap(_validateType(convert));
+ Stream<E>
+ asyncMap<E>(convert(T event)) => _stream.asyncMap(_validateType(convert));
Stream<T> distinct([bool equals(T previous, T next)]) =>
new TypeSafeStream<T>(_stream.distinct(equals == null
? null
: (previous, next) => equals(previous as T, next as T)));
- Future/*<E>*/ drain/*<E>*/([/*=E*/ futureValue]) =>
- _stream.drain(futureValue);
+ Future<E> drain<E>([E futureValue]) => _stream.drain(futureValue);
- Stream/*<S>*/ expand/*<S>*/(Iterable/*<S>*/ convert(T value)) =>
- _stream.expand(_validateType(convert));
+ Stream<S> expand<S>(Iterable<S> convert(T value)) => _stream
+ .expand(_validateType(convert));
Future firstWhere(bool test(T element), {Object defaultValue()}) =>
_stream.firstWhere(_validateType(test), defaultValue: defaultValue);
@@ -63,10 +62,9 @@ class TypeSafeStream<T> implements Stream<T> {
Future<T> singleWhere(bool test(T element)) async =>
(await _stream.singleWhere(_validateType(test))) as T;
- Future/*<S>*/ fold/*<S>*/(/*=S*/ initialValue,
- /*=S*/ combine(/*=S*/ previous, T element)) =>
- _stream.fold(initialValue,
- (previous, element) => combine(previous, element as T));
+ Future<S> fold<S>(S initialValue, S combine(S previous, T element)) => _stream
+ .fold(
+ initialValue, (previous, element) => combine(previous, element as T));
Future forEach(void action(T element)) =>
_stream.forEach(_validateType(action));
@@ -79,8 +77,7 @@ class TypeSafeStream<T> implements Stream<T> {
new TypeSafeStreamSubscription<T>(_stream.listen(_validateType(onData),
onError: onError, onDone: onDone, cancelOnError: cancelOnError));
- Stream/*<S>*/ map/*<S>*/(/*=S*/ convert(T event)) =>
- _stream.map(_validateType(convert));
+ Stream<S> map<S>(S convert(T event)) => _stream.map(_validateType(convert));
// Don't forward to `_stream.pipe` because we want the consumer to see the
// type-asserted stream.
@@ -88,8 +85,8 @@ class TypeSafeStream<T> implements Stream<T> {
consumer.addStream(this).then((_) => consumer.close());
Future<T> reduce(T combine(T previous, T element)) async {
- var result = await _stream.reduce(
- (previous, element) => combine(previous as T, element as T));
+ var result = await _stream
+ .reduce((previous, element) => combine(previous as T, element as T));
return result as T;
}
@@ -100,21 +97,18 @@ class TypeSafeStream<T> implements Stream<T> {
new TypeSafeStream<T>(_stream.takeWhile(_validateType(test)));
Stream<T> timeout(Duration timeLimit, {void onTimeout(EventSink<T> sink)}) =>
- new TypeSafeStream<T>(_stream.timeout(
- timeLimit,
+ new TypeSafeStream<T>(_stream.timeout(timeLimit,
onTimeout: (sink) => onTimeout(DelegatingEventSink.typed(sink))));
Future<List<T>> toList() async =>
- DelegatingList.typed/*<T>*/(await _stream.toList());
+ DelegatingList.typed<T>(await _stream.toList());
- Future<Set<T>> toSet() async =>
- DelegatingSet.typed/*<T>*/(await _stream.toSet());
+ Future<Set<T>> toSet() async => DelegatingSet.typed<T>(await _stream.toSet());
// Don't forward to `_stream.transform` because we want the transformer to see
// the type-asserted stream.
- Stream/*<S>*/ transform/*<S>*/(
- StreamTransformer<T, dynamic/*=S*/> transformer) =>
- transformer.bind(this);
+ Stream<S> transform<S>(StreamTransformer<T, S> transformer) => transformer
+ .bind(this);
Stream<T> where(bool test(T element)) =>
new TypeSafeStream<T>(_stream.where(_validateType(test)));
@@ -132,7 +126,6 @@ class TypeSafeStream<T> implements Stream<T> {
/// Returns a version of [function] that asserts that its argument is an
/// instance of `T`.
- UnaryFunction/*<dynamic, S>*/ _validateType/*<S>*/(
- /*=S*/ function(T value)) =>
+ UnaryFunction<dynamic, S> _validateType<S>(S function(T value)) =>
function == null ? null : (value) => function(value as T);
}

Powered by Google App Engine
This is Rietveld 408576698