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

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

Issue 2786083002: Read platform.dill in the VM. (Closed)
Patch Set: Incorporate review comments and merge. Created 3 years, 8 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 | pkg/front_end/lib/src/fasta/kernel/kernel_target.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/fasta/fasta.dart
diff --git a/pkg/front_end/lib/src/fasta/fasta.dart b/pkg/front_end/lib/src/fasta/fasta.dart
index ccc2196bba61bc756994dd4b1a9e20b4eed8a1de..66b7ff8bb41bf811e32aa750ae52323f027ee35e 100644
--- a/pkg/front_end/lib/src/fasta/fasta.dart
+++ b/pkg/front_end/lib/src/fasta/fasta.dart
@@ -10,7 +10,8 @@ import 'dart:convert' show JSON;
import 'dart:io' show BytesBuilder, Directory, File, exitCode;
-import 'package:kernel/binary/ast_to_binary.dart' show BinaryPrinter;
+import 'package:kernel/binary/ast_to_binary.dart'
+ show LibraryFilteringBinaryPrinter;
import 'package:kernel/kernel.dart' show Program;
@@ -199,9 +200,17 @@ Future<CompilationResult> parseScript(
target.performModularTransformations(program);
target.performGlobalTransformations(program);
- // Write the program to a list of bytes and return it.
+ // Write the program to a list of bytes and return it. Do not include
+ // libraries that have a dart: import URI.
+ //
+ // TODO(kmillikin): This is intended to exclude platform libraries that are
+ // included in the Kernel binary platform platform.dill. It does not
+ // necessarily exclude exactly the platform libraries. Use a better
+ // predicate that knows what is included in platform.dill.
var sink = new ByteSink();
- new BinaryPrinter(sink).writeProgramFile(program);
+ bool predicate(Library library) => !library.importUri.isScheme('dart');
+ new LibraryFilteringBinaryPrinter(sink, predicate)
+ .writeProgramFile(program);
return new CompilationResult.ok(sink.builder.takeBytes());
} catch (e, s) {
return reportCrash(e, s, fileName);
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/kernel/kernel_target.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698