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

Unified Diff: lib/src/asset/dart/serialize.dart

Issue 2184303002: Make pub strong-mode clean. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Code review changes Created 4 years, 5 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
« no previous file with comments | « lib/src/ascii_tree.dart ('k') | lib/src/asset/dart/serialize/aggregate_transform.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/asset/dart/serialize.dart
diff --git a/lib/src/asset/dart/serialize.dart b/lib/src/asset/dart/serialize.dart
index f95022d65f38c28e3e380621eb297bfa88721fe7..7af294171080c45bf04820e8a4dd77d20e0e3000 100644
--- a/lib/src/asset/dart/serialize.dart
+++ b/lib/src/asset/dart/serialize.dart
@@ -5,6 +5,7 @@
import 'dart:async';
import 'dart:isolate';
+import 'package:async/async.dart';
import 'package:barback/barback.dart';
//# if source_span
@@ -12,7 +13,6 @@ import 'package:source_span/source_span.dart';
//# end
import 'serialize/exception.dart';
-import 'utils.dart';
export 'serialize/aggregate_transform.dart';
export 'serialize/exception.dart';
@@ -77,7 +77,7 @@ SourceLocation deserializeLocation(Map location) {
/// Converts [stream] into a serializable map.
///
/// [serializeEvent] is used to serialize each event from the stream.
-Map serializeStream(Stream stream, serializeEvent(event)) {
+Map serializeStream/*<T>*/(Stream/*<T>*/ stream, serializeEvent(/*=T*/ event)) {
var receivePort = new ReceivePort();
var map = {'replyTo': receivePort.sendPort};
@@ -102,8 +102,9 @@ Map serializeStream(Stream stream, serializeEvent(event)) {
/// Converts a serializable map into a [Stream].
///
/// [deserializeEvent] is used to deserialize each event from the stream.
-Stream deserializeStream(Map stream, deserializeEvent(event)) {
- return callbackStream(() {
+Stream/*<T>*/ deserializeStream/*<T>*/(Map stream,
+ /*=T*/ deserializeEvent(event)) {
+ return new LazyStream(() {
var receivePort = new ReceivePort();
stream['replyTo'].send({'replyTo': receivePort.sendPort});
@@ -133,15 +134,18 @@ Stream deserializeStream(Map stream, deserializeEvent(event)) {
///
/// The returned Future will complete to the value or error returned by
/// [respond].
-Future call(SendPort port, message) {
+Future/*<T>*/ call/*<T>*/(SendPort port, message) {
var receivePort = new ReceivePort();
port.send({
'message': message,
'replyTo': receivePort.sendPort
});
- return receivePort.first.then((response) {
- if (response['type'] == 'success') return response['value'];
+ return new Future.sync(() async {
+ var response = await receivePort.first;
+ if (response['type'] == 'success') {
+ return response['value'] as dynamic/*=T*/;
+ }
assert(response['type'] == 'error');
var exception = deserializeException(response['error']);
return new Future.error(exception, exception.stackTrace);
« no previous file with comments | « lib/src/ascii_tree.dart ('k') | lib/src/asset/dart/serialize/aggregate_transform.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698