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

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

Issue 2976543002: Reapply "Tweak public APIs and use them in patch_sdk, dart2js, and kernel-service."" (Closed)
Patch Set: fix 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
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 b78ac35fb1de46a5c65c5cd551266042d1ea5ec6..4b1ca3273197de89fd8042b5761aa4a4f8f9d674 100644
--- a/pkg/front_end/lib/src/incremental_kernel_generator_impl.dart
+++ b/pkg/front_end/lib/src/incremental_kernel_generator_impl.dart
@@ -3,7 +3,6 @@
// 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';
@@ -13,27 +12,17 @@ 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.
@@ -268,7 +257,8 @@ class IncrementalKernelGeneratorImpl implements IncrementalKernelGenerator {
_logger.run('Serialize ${kernelLibraries.length} libraries', () {
program.uriToSource.clear();
- List<int> bytes = _writeProgramBytes(program, kernelLibraries.contains);
+ List<int> bytes =
+ serializeProgram(program, filter: kernelLibraries.contains);
_byteStore.put(kernelKey, bytes);
_logger.writeln('Stored ${bytes.length} bytes.');
});
@@ -374,12 +364,6 @@ 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.

Powered by Google App Engine
This is Rietveld 408576698