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

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

Issue 2896493002: Add LimitedBinaryPrinter, tests and switch incremental generator to it. (Closed)
Patch Set: Move LimitedBinaryPrinter to kernel, remove comments. 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/incremental_kernel_generator_impl.dart
diff --git a/pkg/front_end/lib/src/incremental_kernel_generator_impl.dart b/pkg/front_end/lib/src/incremental_kernel_generator_impl.dart
index 05e88e2a392f24d2618374ace8f9a5bb9c041adf..ba23aba1f337814d0b5d57b0b8d8c185648f018b 100644
--- a/pkg/front_end/lib/src/incremental_kernel_generator_impl.dart
+++ b/pkg/front_end/lib/src/incremental_kernel_generator_impl.dart
@@ -18,7 +18,7 @@ import 'package:front_end/src/fasta/translate_uri.dart';
import 'package:front_end/src/incremental/byte_store.dart';
import 'package:front_end/src/incremental/file_state.dart';
import 'package:kernel/binary/ast_from_binary.dart';
-import 'package:kernel/binary/ast_to_binary.dart';
+import 'package:kernel/binary/limited_ast_to_binary.dart';
import 'package:kernel/kernel.dart' hide Source;
dynamic unimplemented() {
@@ -121,6 +121,7 @@ class IncrementalKernelGeneratorImpl implements IncrementalKernelGenerator {
if (_latestSignature[uri] != result.signature) {
_latestSignature[uri] = result.signature;
program.libraries.add(library);
+ library.parent = program;
}
}
}
@@ -225,6 +226,7 @@ class IncrementalKernelGeneratorImpl implements IncrementalKernelGenerator {
_logger.run('Serialize ${kernelLibraries.length} libraries', () {
program.unbindCanonicalNames();
+ program.uriToSource.clear();
List<int> bytes = _writeProgramBytes(program, kernelLibraries.contains);
_byteStore.put(kernelKey, bytes);
_logger.writeln('Stored ${bytes.length} bytes.');
@@ -284,8 +286,7 @@ class IncrementalKernelGeneratorImpl implements IncrementalKernelGenerator {
List<int> _writeProgramBytes(Program program, bool filter(Library library)) {
ByteSink byteSink = new ByteSink();
- new LibraryFilteringBinaryPrinter(byteSink, filter)
- .writeProgramFile(program);
+ new LimitedBinaryPrinter(byteSink, filter).writeProgramFile(program);
return byteSink.builder.takeBytes();
}
}

Powered by Google App Engine
This is Rietveld 408576698