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

Unified Diff: pkg/front_end/lib/summary_generator.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/summary_generator.dart
diff --git a/pkg/front_end/lib/summary_generator.dart b/pkg/front_end/lib/summary_generator.dart
index 0c494c42a7ad252f356b34dfee9589243990d877..539cc2b272221e8b2f816b49e04c32cdb856c79d 100644
--- a/pkg/front_end/lib/summary_generator.dart
+++ b/pkg/front_end/lib/summary_generator.dart
@@ -8,6 +8,9 @@ library front_end.summary_generator;
import 'dart:async';
import 'compiler_options.dart';
+import 'src/base/processed_options.dart';
+import 'src/kernel_generator_impl.dart';
+
/// Creates a summary representation of the build unit whose source files are in
/// [sources].
///
@@ -16,17 +19,25 @@ import 'compiler_options.dart';
/// [sources] should be the complete set of source files for a build unit
/// (including both library and part files).
///
-/// The summarization process is hermetic, meaning that the only files which
-/// will be read are those listed in [sources],
+/// By default, the compilation process is hermetic, meaning that the only files
+/// which will be read are those listed in [sources],
/// [CompilerOptions.inputSummaries], and [CompilerOptions.sdkSummary]. If a
/// source file attempts to refer to a file which is not obtainable from these
-/// paths, that will result in an error, even if the file exists on the
+/// URIs, that will result in an error, even if the file exists on the
/// filesystem.
///
+/// When [CompilerOptions.chaseDependencies] is true, this default behavior
+/// changes, and any dependency of [sources] that is not listed in
+/// [CompilerOptions.inputSummaries] and [CompilerOptions.sdkSummary] is treated
+/// as an additional source file for the build unit.
+///
/// Any `part` declarations found in [sources] must refer to part files which
-/// are also listed in [sources], otherwise an error results. (It is not
-/// permitted to refer to a part file declared in another build unit).
+/// are also listed in the build unit sources, otherwise an error results. (It
+/// is not permitted to refer to a part file declared in another build unit).
///
/// The return value is a list of bytes to write to the summary file.
-Future<List<int>> summaryFor(List<Uri> sources, CompilerOptions options) =>
- throw new UnimplementedError();
+Future<List<int>> summaryFor(List<Uri> sources, CompilerOptions options) async {
+ return (await generateKernel(new ProcessedOptions(options, true, sources),
+ buildSummary: true, buildProgram: false))
+ ?.summary;
+}

Powered by Google App Engine
This is Rietveld 408576698