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

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

Issue 937243002: Revert "Revert "Use native async/await support in pub."" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/pub_generated/asset/dart/serialize/transformer.dart
diff --git a/sdk/lib/_internal/pub_generated/asset/dart/serialize/transformer.dart b/sdk/lib/_internal/pub_generated/asset/dart/serialize/transformer.dart
deleted file mode 100644
index 16d02deb5790116cc24428521f357ba1fbd6f872..0000000000000000000000000000000000000000
--- a/sdk/lib/_internal/pub_generated/asset/dart/serialize/transformer.dart
+++ /dev/null
@@ -1,126 +0,0 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.asset.serialize.transformer;
-
-import 'dart:async';
-import 'dart:isolate';
-
-import 'package:barback/barback.dart';
-
-import '../serialize.dart';
-import 'transform.dart';
-
-/// Converts [transformer] into a serializable map.
-Map _serializeTransformer(Transformer transformer) {
- var port = new ReceivePort();
- port.listen((wrappedMessage) {
- respond(wrappedMessage, (message) {
- if (message['type'] == 'isPrimary') {
- return transformer.isPrimary(deserializeId(message['id']));
- } else if (message['type'] == 'declareOutputs') {
- 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 new Future.sync(() {
- return transformer.apply(new ForeignTransform(message['transform']));
- }).then((_) => null);
- }
- });
- });
-
- var type;
- if (transformer is LazyTransformer) {
- type = 'LazyTransformer';
- } else if (transformer is DeclaringTransformer) {
- type = 'DeclaringTransformer';
- } else {
- type = 'Transformer';
- }
-
- return {
- 'type': type,
- 'toString': transformer.toString(),
- 'port': port.sendPort
- };
-}
-
-/// Converts [transformer] into a serializable map.
-Map _serializeAggregateTransformer(AggregateTransformer transformer) {
- var port = new ReceivePort();
- port.listen((wrappedMessage) {
- respond(wrappedMessage, (message) {
- if (message['type'] == 'classifyPrimary') {
- return transformer.classifyPrimary(deserializeId(message['id']));
- } else if (message['type'] == 'declareOutputs') {
- return new Future.sync(() {
- return (transformer as DeclaringAggregateTransformer).declareOutputs(
- new ForeignDeclaringAggregateTransform(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 new Future.sync(() {
- return transformer.apply(
- new ForeignAggregateTransform(message['transform']));
- }).then((_) => null);
- }
- });
- });
-
- var type;
- if (transformer is LazyAggregateTransformer) {
- type = 'LazyAggregateTransformer';
- } else if (transformer is DeclaringAggregateTransformer) {
- type = 'DeclaringAggregateTransformer';
- } else {
- type = 'AggregateTransformer';
- }
-
- return {
- 'type': type,
- 'toString': transformer.toString(),
- 'port': port.sendPort
- };
-}
-
-// Converts [group] into a serializable map.
-Map _serializeTransformerGroup(TransformerGroup group) {
- if (group.phases == null) {
- throw "TransformerGroup $group phases cannot be null.";
- }
-
- return {
- 'type': 'TransformerGroup',
- 'toString': group.toString(),
- 'phases': group.phases.map((phase) {
- return phase.map(serializeTransformerLike).toList();
- }).toList()
- };
-}
-
-/// Converts [transformerLike] into a serializable map.
-///
-/// [transformerLike] can be a [Transformer], an [AggregateTransformer], or a
-/// [TransformerGroup].
-Map serializeTransformerLike(transformerLike) {
- if (transformerLike is Transformer) {
- return _serializeTransformer(transformerLike);
- } else if (transformerLike is TransformerGroup) {
- return _serializeTransformerGroup(transformerLike);
- } else {
- // This has to be last, since "transformerLike is AggregateTransformer" will
- // throw on older versions of barback.
- assert(transformerLike is AggregateTransformer);
- return _serializeAggregateTransformer(transformerLike);
- }
-}

Powered by Google App Engine
This is Rietveld 408576698