| Index: sdk/lib/_internal/pub/lib/src/barback/rewrite_import_transformer.dart
|
| diff --git a/sdk/lib/_internal/pub/lib/src/barback/rewrite_import_transformer.dart b/sdk/lib/_internal/pub/lib/src/barback/rewrite_import_transformer.dart
|
| index 8392289e3e33d8d0d4d7b8815b84a6f36b7ace63..7482d620a840df40be7a5ecdb6c093888f231a6a 100644
|
| --- a/sdk/lib/_internal/pub/lib/src/barback/rewrite_import_transformer.dart
|
| +++ b/sdk/lib/_internal/pub/lib/src/barback/rewrite_import_transformer.dart
|
| @@ -7,7 +7,8 @@ library pub.rewrite_import_transformer;
|
| import 'dart:async';
|
|
|
| import 'package:barback/barback.dart';
|
| -import 'package:analyzer/analyzer.dart';
|
| +
|
| +import '../dart.dart';
|
|
|
| /// A transformer used internally to rewrite "package:" imports so they point to
|
| /// the barback server rather than to pub's package root.
|
| @@ -16,13 +17,12 @@ class RewriteImportTransformer extends Transformer {
|
|
|
| Future apply(Transform transform) {
|
| return transform.primaryInput.readAsString().then((contents) {
|
| - var collector = new _DirectiveCollector();
|
| - parseDirectives(contents, name: transform.primaryInput.id.toString())
|
| - .accept(collector);
|
| + var directives = parseImportsAndExports(contents,
|
| + name: transform.primaryInput.id.toString());
|
|
|
| var buffer = new StringBuffer();
|
| var index = 0;
|
| - for (var directive in collector.directives) {
|
| + for (var directive in directives) {
|
| var uri = Uri.parse(directive.uri.stringValue);
|
| if (uri.scheme != 'package') continue;
|
|
|
| @@ -38,10 +38,3 @@ class RewriteImportTransformer extends Transformer {
|
| });
|
| }
|
| }
|
| -
|
| -/// A simple visitor that collects import and export nodes.
|
| -class _DirectiveCollector extends GeneralizingAstVisitor {
|
| - final directives = <UriBasedDirective>[];
|
| -
|
| - visitUriBasedDirective(UriBasedDirective node) => directives.add(node);
|
| -}
|
|
|