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

Unified Diff: pkg/front_end/lib/src/fasta/kernel/utils.dart

Issue 2893233003: Let printProgramText() to use filter to print only some libraries. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « pkg/front_end/lib/src/fasta/kernel/kernel_target.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/fasta/kernel/utils.dart
diff --git a/pkg/front_end/lib/src/fasta/kernel/utils.dart b/pkg/front_end/lib/src/fasta/kernel/utils.dart
index 9bb7a2f014b58c0ead18ad68795e56f1a054321e..df9748ba387553c27d01cb8690ec00f48eefa775 100644
--- a/pkg/front_end/lib/src/fasta/kernel/utils.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/utils.dart
@@ -15,11 +15,14 @@ import 'package:kernel/text/ast_to_text.dart';
int offsetForToken(Token token) =>
token == null ? TreeNode.noOffset : token.offset;
-/// Print the given [program]. Do nothing if it is `null`.
-void printProgramText(Program program) {
+/// Print the given [program]. Do nothing if it is `null`. If the
+/// [libraryFilter] is provided, then only libraries that satisfy it are
+/// printed.
+void printProgramText(Program program, {bool libraryFilter(Library library)}) {
if (program == null) return;
StringBuffer sb = new StringBuffer();
for (Library library in program.libraries) {
+ if (libraryFilter != null && !libraryFilter(library)) continue;
Printer printer = new Printer(sb);
printer.writeLibraryFile(library);
}
« no previous file with comments | « pkg/front_end/lib/src/fasta/kernel/kernel_target.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698