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

Unified Diff: sdk/lib/_internal/pub/asset/dart/serialize/transformer.dart

Issue 243793005: Don't require Transformer methods to return Futures. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 8 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 | « pkg/barback/test/utils.dart ('k') | sdk/lib/_internal/pub/lib/src/barback/dart2js_transformer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/asset/dart/serialize/transformer.dart
diff --git a/sdk/lib/_internal/pub/asset/dart/serialize/transformer.dart b/sdk/lib/_internal/pub/asset/dart/serialize/transformer.dart
index a7d393721de54503da39a3f7d10b8b45e60a3114..e71a01650280b14e7b64429661d59d36284b9b11 100644
--- a/sdk/lib/_internal/pub/asset/dart/serialize/transformer.dart
+++ b/sdk/lib/_internal/pub/asset/dart/serialize/transformer.dart
@@ -4,11 +4,13 @@
library pub.asset.serialize.transformer;
+import 'dart:async';
import 'dart:isolate';
import 'package:barback/barback.dart';
import '../serialize.dart';
+import '../utils.dart';
import 'transform.dart';
/// Converts [transformer] into a serializable map.
@@ -19,16 +21,18 @@ Map _serializeTransformer(Transformer transformer) {
if (message['type'] == 'isPrimary') {
return transformer.isPrimary(deserializeId(message['id']));
} else if (message['type'] == 'declareOutputs') {
- return (transformer as DeclaringTransformer).declareOutputs(
- new ForeignDeclaringTransform(message['transform']))
- .then((_) => null);
+ return new Future.sync(() {
+ return (transformer as DeclaringTransformer).declareOutputs(
+ new ForeignDeclaringTransform(message['transform']));
+ }).then((_) => null);
} else {
assert(message['type'] == 'apply');
// Make sure we return null so that if the transformer's [apply] returns
// a non-serializable value it doesn't cause problems.
- return transformer.apply(
- new ForeignTransform(message['transform'])).then((_) => null);
+ return new Future.sync(() {
+ return transformer.apply(new ForeignTransform(message['transform']));
+ }).then((_) => null);
}
});
});
« no previous file with comments | « pkg/barback/test/utils.dart ('k') | sdk/lib/_internal/pub/lib/src/barback/dart2js_transformer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698