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

Unified Diff: lib/src/result.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/result.dart
diff --git a/lib/src/result.dart b/lib/src/result.dart
index 393dcedd0da135ece88efda08c385eda9b82bdf7..e6181a8299dea4121ac7da62f3f89e628ca0dfa2 100644
--- a/lib/src/result.dart
+++ b/lib/src/result.dart
@@ -76,10 +76,9 @@ abstract class Result<T> {
///
/// The resulting future will never have an error.
/// Errors have been converted to an [ErrorResult] value.
- static Future<Result/*<T>*/> capture/*<T>*/(Future/*<T>*/ future) {
+ static Future<Result<T>> capture<T>(Future<T> future) {
return future.then((value) => new ValueResult(value),
- onError: (error, stackTrace) =>
- new ErrorResult/*<T>*/(error, stackTrace));
+ onError: (error, stackTrace) => new ErrorResult<T>(error, stackTrace));
}
/// Release the result of a captured future.
@@ -89,23 +88,23 @@ abstract class Result<T> {
///
/// If [future] completes with an error, the returned future completes with
/// the same error.
- static Future/*<T>*/ release/*<T>*/(Future<Result/*<T>*/> future) =>
- future.then/*<Future<T>>*/((result) => result.asFuture);
+ static Future<T> release<T>(Future<Result<T>> future) => future
+ .then<Future<T>>((result) => result.asFuture);
/// Capture the results of a stream into a stream of [Result] values.
///
/// The returned stream will not have any error events.
/// Errors from the source stream have been converted to [ErrorResult]s.
- static Stream<Result/*<T>*/> captureStream/*<T>*/(Stream/*<T>*/ source) =>
- source.transform(new CaptureStreamTransformer/*<T>*/());
+ static Stream<Result<T>> captureStream<T>(Stream<T> source) => source
+ .transform(new CaptureStreamTransformer<T>());
/// Release a stream of [result] values into a stream of the results.
///
/// `Result` values of the source stream become value or error events in
/// the returned stream as appropriate.
/// Errors from the source stream become errors in the returned stream.
- static Stream/*<T>*/ releaseStream/*<T>*/(Stream<Result/*<T>*/> source) =>
- source.transform(new ReleaseStreamTransformer/*<T>*/());
+ static Stream<T> releaseStream<T>(Stream<Result<T>> source) => source
+ .transform(new ReleaseStreamTransformer<T>());
/// Converts a result of a result to a single result.
///
@@ -113,10 +112,9 @@ abstract class Result<T> {
/// which is then an error, then a result with that error is returned.
/// Otherwise both levels of results are value results, and a single
/// result with the value is returned.
- static Result/*<T>*/ flatten/*<T>*/(Result<Result/*<T>*/> result) {
+ static Result<T> flatten<T>(Result<Result<T>> result) {
if (result.isValue) return result.asValue.value;
- return new ErrorResult/*<T>*/(
- result.asError.error, result.asError.stackTrace);
+ return new ErrorResult<T>(result.asError.error, result.asError.stackTrace);
}
/// Whether this result is a value result.

Powered by Google App Engine
This is Rietveld 408576698