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

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

Issue 2979463002: Revert "Tweak public APIs and use them in patch_sdk, dart2js, and kernel-service." (Closed)
Patch Set: Created 3 years, 5 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 | « pkg/front_end/lib/src/fasta/vm.dart ('k') | pkg/front_end/lib/src/kernel_generator_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4b1ca3273197de89fd8042b5761aa4a4f8f9d674..b78ac35fb1de46a5c65c5cd551266042d1ea5ec6 100644
--- a/pkg/front_end/lib/src/incremental_kernel_generator_impl.dart
+++ b/pkg/front_end/lib/src/incremental_kernel_generator_impl.dart
@@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
+import 'dart:io';
import 'package:front_end/file_system.dart';
import 'package:front_end/incremental_kernel_generator.dart';
@@ -12,17 +13,27 @@ import 'package:front_end/src/base/processed_options.dart';
import 'package:front_end/src/fasta/dill/dill_library_builder.dart';
import 'package:front_end/src/fasta/dill/dill_target.dart';
import 'package:front_end/src/fasta/kernel/kernel_target.dart';
-import 'package:front_end/src/fasta/kernel/utils.dart';
import 'package:front_end/src/fasta/ticker.dart';
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/limited_ast_to_binary.dart';
import 'package:kernel/kernel.dart' hide Source;
import 'package:kernel/target/targets.dart' show TargetFlags;
import 'package:kernel/target/vm_fasta.dart' show VmFastaTarget;
import 'package:meta/meta.dart';
+class ByteSink implements Sink<List<int>> {
+ final BytesBuilder builder = new BytesBuilder();
+
+ void add(List<int> data) {
+ builder.add(data);
+ }
+
+ void close() {}
+}
+
/// Implementation of [IncrementalKernelGenerator].
///
/// TODO(scheglov) Update the documentation.
@@ -257,8 +268,7 @@ class IncrementalKernelGeneratorImpl implements IncrementalKernelGenerator {
_logger.run('Serialize ${kernelLibraries.length} libraries', () {
program.uriToSource.clear();
- List<int> bytes =
- serializeProgram(program, filter: kernelLibraries.contains);
+ List<int> bytes = _writeProgramBytes(program, kernelLibraries.contains);
_byteStore.put(kernelKey, bytes);
_logger.writeln('Stored ${bytes.length} bytes.');
});
@@ -364,6 +374,12 @@ class IncrementalKernelGeneratorImpl implements IncrementalKernelGenerator {
}
});
}
+
+ List<int> _writeProgramBytes(Program program, bool filter(Library library)) {
+ ByteSink byteSink = new ByteSink();
+ new LimitedBinaryPrinter(byteSink, filter).writeProgramFile(program);
+ return byteSink.builder.takeBytes();
+ }
}
/// Compilation result for a library cycle.
« no previous file with comments | « pkg/front_end/lib/src/fasta/vm.dart ('k') | pkg/front_end/lib/src/kernel_generator_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698