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

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

Issue 2886233002: Remove 'dumpIr' from writeProgram() and KernelTarget. (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
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 794e90416438c8da04e6a4f2e95ac9d1fa0cad97..6748f99a01758c06ff26ea507cfd5e6bf3308725 100644
--- a/pkg/front_end/lib/src/fasta/kernel/utils.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/utils.dart
@@ -4,8 +4,20 @@
import 'package:front_end/src/scanner/token.dart' show Token;
import 'package:kernel/ast.dart';
+import 'package:kernel/text/ast_to_text.dart';
/// A null-aware alternative to `token.offset`. If [token] is `null`, returns
/// `TreeNode.noOffset`.
int offsetForToken(Token token) =>
token == null ? TreeNode.noOffset : token.offset;
+
+/// Print the given [program]. Do nothing if it is `null`.
+void printProgramText(Program program) {
+ if (program == null) return;
+ StringBuffer sb = new StringBuffer();
+ for (Library library in program.libraries) {
ahe 2017/05/22 13:40:18 This includes all libraries (including platform.di
+ Printer printer = new Printer(sb);
+ printer.writeLibraryFile(library);
+ }
+ print(sb);
+}

Powered by Google App Engine
This is Rietveld 408576698