| Index: sdk/lib/_internal/pub/lib/src/dart.dart
|
| diff --git a/sdk/lib/_internal/pub/lib/src/dart.dart b/sdk/lib/_internal/pub/lib/src/dart.dart
|
| index 64374db6774f06e3e7b94c9bcec6d24cd3271390..9a8510568c66d70f3fd0a814d5500cdcf78187c7 100644
|
| --- a/sdk/lib/_internal/pub/lib/src/dart.dart
|
| +++ b/sdk/lib/_internal/pub/lib/src/dart.dart
|
| @@ -122,6 +122,22 @@ bool isEntrypoint(CompilationUnit dart) {
|
| });
|
| }
|
|
|
| +/// Efficiently parses the import and export directives in [contents].
|
| +///
|
| +/// If [name] is passed, it's used as the filename for error reporting.
|
| +List<UriBasedDirective> parseImportsAndExports(String contents, {String name}) {
|
| + var collector = new _DirectiveCollector();
|
| + parseDirectives(contents, name: name).accept(collector);
|
| + return collector.directives;
|
| +}
|
| +
|
| +/// A simple visitor that collects import and export nodes.
|
| +class _DirectiveCollector extends GeneralizingAstVisitor {
|
| + final directives = <UriBasedDirective>[];
|
| +
|
| + visitUriBasedDirective(UriBasedDirective node) => directives.add(node);
|
| +}
|
| +
|
| /// Runs [code] in an isolate.
|
| ///
|
| /// [code] should be the contents of a Dart entrypoint. It may contain imports;
|
|
|