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

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

Issue 2784303003: Allow dartk to print out binary Kernel IR results to stdout if requested. (Closed)
Patch Set: . Created 3 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/lib/kernel.dart
diff --git a/pkg/kernel/lib/kernel.dart b/pkg/kernel/lib/kernel.dart
index 361f59aaa265445c0a472feb4138df8e821c00b3..752617b9d3fc2ed5ee541fd11667fa9026c92417 100644
--- a/pkg/kernel/lib/kernel.dart
+++ b/pkg/kernel/lib/kernel.dart
@@ -29,13 +29,24 @@ Program loadProgramFromBinary(String path, [Program program]) {
}
Future writeProgramToBinary(Program program, String path) {
- var sink = new File(path).openWrite();
+ var sink;
+ if (path == 'null' || path == 'stdout') {
+ sink = stdout.nonBlocking;
+ } else {
+ sink = new File(path).openWrite();
+ }
+
var future;
try {
new BinaryPrinter(sink).writeProgramFile(program);
} finally {
- future = sink.close();
+ if (sink == stdout.nonBlocking) {
+ future = sink.flush();
+ } else {
+ future = sink.close();
+ }
}
+
return future;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698