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

Unified Diff: pkg/kernel/lib/binary/limited_ast_to_binary.dart

Issue 2953703002: Tweak public APIs and use them in patch_sdk, dart2js, and kernel-service (Closed)
Patch Set: Created 3 years, 6 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: 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..e196a76820a9c94c4a083894db3d629f169b0690 100644
--- a/pkg/kernel/lib/binary/limited_ast_to_binary.dart
+++ b/pkg/kernel/lib/binary/limited_ast_to_binary.dart
@@ -13,7 +13,13 @@ import 'package:kernel/binary/ast_to_binary.dart';
class LimitedBinaryPrinter extends BinaryPrinter {
final LibraryFilter predicate;
- LimitedBinaryPrinter(Sink<List<int>> sink, this.predicate)
+ /// Excludes also all uriToSource information.
ahe 2017/07/06 13:12:22 "also" implies a context that's kinda missing here
Siggi Cherem (dart-lang) 2017/07/06 19:05:28 Done. The "what" was is basically everything this
+ // TODO(sigmund): provide a way to filter sources based on their
+ // corresponding libraries (or the filter specified above).
+ final bool excludeUriToSource;
+
+ LimitedBinaryPrinter(
+ Sink<List<int>> sink, this.predicate, this.excludeUriToSource)
: super(sink, stringIndexer: new ReferencesStringIndexer());
@override
@@ -62,6 +68,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

Powered by Google App Engine
This is Rietveld 408576698