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

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

Issue 2872903005: Rework DillLoader to allow adding multiple dills. (Closed)
Patch Set: Fixes for review changes. 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/kernel/lib/kernel.dart
diff --git a/pkg/kernel/lib/kernel.dart b/pkg/kernel/lib/kernel.dart
index 752617b9d3fc2ed5ee541fd11667fa9026c92417..48af8f45c6d20bc1c52f226c4a46771aa559fc1a 100644
--- a/pkg/kernel/lib/kernel.dart
+++ b/pkg/kernel/lib/kernel.dart
@@ -23,8 +23,13 @@ import 'text/ast_to_text.dart';
export 'ast.dart';
Program loadProgramFromBinary(String path, [Program program]) {
+ List<int> bytes = new File(path).readAsBytesSync();
+ return loadProgramFromBytes(bytes, program);
+}
+
+Program loadProgramFromBytes(List<int> bytes, [Program program]) {
program ??= new Program();
- new BinaryBuilder(new File(path).readAsBytesSync()).readProgram(program);
+ new BinaryBuilder(bytes).readProgram(program);
return program;
}

Powered by Google App Engine
This is Rietveld 408576698