| Index: pkg/kernel/lib/binary/limited_ast_to_binary.dart
|
| diff --git a/pkg/kernel/lib/binary/limited_ast_to_binary.dart b/pkg/kernel/lib/binary/limited_ast_to_binary.dart
|
| index 6446fe5d06ea0a35aaa47c6a6da88ddf9568b803..1d0e04768d0a44e2dc1c99fb426feba094fc1967 100644
|
| --- a/pkg/kernel/lib/binary/limited_ast_to_binary.dart
|
| +++ b/pkg/kernel/lib/binary/limited_ast_to_binary.dart
|
| @@ -13,7 +13,17 @@ import 'package:kernel/binary/ast_to_binary.dart';
|
| class LimitedBinaryPrinter extends BinaryPrinter {
|
| final LibraryFilter predicate;
|
|
|
| - LimitedBinaryPrinter(Sink<List<int>> sink, this.predicate)
|
| + /// Excludes all uriToSource information.
|
| + ///
|
| + /// By default the [predicate] above will only exclude canonical names and
|
| + /// kernel libraries, but it will still emit the sources for all libraries.
|
| + /// filtered by libraries matching [predicate].
|
| + // TODO(sigmund): provide a way to filter sources directly based on
|
| + // [predicate]. That requires special logic to handle sources from part files.
|
| + final bool excludeUriToSource;
|
| +
|
| + LimitedBinaryPrinter(
|
| + Sink<List<int>> sink, this.predicate, this.excludeUriToSource)
|
| : super(sink, stringIndexer: new ReferencesStringIndexer());
|
|
|
| @override
|
| @@ -62,6 +72,20 @@ class LimitedBinaryPrinter extends BinaryPrinter {
|
| if (node is Library && !predicate(node)) return;
|
| node.accept(this);
|
| }
|
| +
|
| + @override
|
| + void writeUriToSource(Program program) {
|
| + if (!excludeUriToSource) {
|
| + super.writeUriToSource(program);
|
| + } else {
|
| + // Emit a practically empty uriToSrouce table.
|
| + writeStringTable(new StringIndexer());
|
| +
|
| + // Add an entry for '', which is always included by default.
|
| + writeUtf8Bytes(const <int>[]);
|
| + writeUInt30(0);
|
| + }
|
| + }
|
| }
|
|
|
| /// Extension of [StringIndexer] that also indexes canonical names of
|
|
|