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

Unified Diff: pkg/front_end/lib/kernel_generator.dart

Issue 2894273002: Revert "First step for modular output in fasta." (Closed)
Patch Set: 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
« no previous file with comments | « pkg/front_end/lib/compiler_options.dart ('k') | pkg/front_end/lib/src/base/processed_options.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/kernel_generator.dart
diff --git a/pkg/front_end/lib/kernel_generator.dart b/pkg/front_end/lib/kernel_generator.dart
index 0f5a4d888365aa8dacd1b1ec7f60d4d6b4945491..6292ae300b8289681e46b96c4dc95afcde3f2ffd 100644
--- a/pkg/front_end/lib/kernel_generator.dart
+++ b/pkg/front_end/lib/kernel_generator.dart
@@ -8,7 +8,7 @@ library front_end.kernel_generator;
import 'compiler_options.dart';
import 'dart:async' show Future;
import 'dart:async';
-import 'package:front_end/src/base/processed_options.dart';
+import 'package:front_end/physical_file_system.dart';
import 'src/fasta/dill/dill_target.dart' show DillTarget;
import 'src/fasta/errors.dart' show InputError;
import 'src/fasta/kernel/kernel_target.dart' show KernelTarget;
@@ -29,13 +29,15 @@ import 'src/simple_error.dart';
/// If `compileSdk` in [options] is true, the generated program will include
/// code for the SDK.
///
-/// If summaries are provided in [options], they will be used to speed up
-/// the process. If in addition `compileSdk` is false, then the resulting
-/// program will not contain the sdk contents. This is useful when building apps
-/// for platforms that already embed the sdk (e.g. the VM), so there is no need
-/// to spend time and space rebuilding it.
+/// If summaries are provided in [options], they may be used to speed up
+/// analysis. If in addition `compileSdk` is false, this will speed up
+/// compilation, as no source of the sdk will be generated. Note however, that
+/// summaries for application code can also speed up analysis, but they will not
+/// take the place of Dart source code (since the Dart source code is still
+/// needed to access the contents of method bodies).
Future<Program> kernelForProgram(Uri source, CompilerOptions options) async {
var fs = options.fileSystem;
+
report(String msg) {
options.onError(new SimpleError(msg));
return null;
@@ -45,19 +47,16 @@ Future<Program> kernelForProgram(Uri source, CompilerOptions options) async {
return report("Entry-point file not found: $source");
}
- var pOptions = new ProcessedOptions(options);
-
- if (!await pOptions.validateOptions()) return null;
+ if (!await validateOptions(options)) return null;
try {
- TranslateUri uriTranslator = await pOptions.getUriTranslator();
+ TranslateUri uriTranslator = await TranslateUri.parse(
+ PhysicalFileSystem.instance, null, options.packagesFileUri);
var dillTarget =
new DillTarget(new Ticker(isVerbose: false), uriTranslator);
- var summary = await pOptions.sdkSummaryProgram;
- if (summary != null) {
- dillTarget.loader.appendLibraries(summary);
- }
+ var summary = options.sdkSummary;
+ if (summary != null) dillTarget.read(summary);
var kernelTarget = new KernelTarget(
options.fileSystem, dillTarget, uriTranslator, options.strongMode);
@@ -65,7 +64,7 @@ Future<Program> kernelForProgram(Uri source, CompilerOptions options) async {
await dillTarget.buildOutlines();
await kernelTarget.buildOutlines();
- Program program = await kernelTarget.buildProgram(trimDependencies: true);
+ Program program = await kernelTarget.buildProgram();
if (kernelTarget.errors.isNotEmpty) {
kernelTarget.errors.forEach(report);
@@ -122,63 +121,5 @@ Future<Program> kernelForProgram(Uri source, CompilerOptions options) async {
/// obtained from?
Future<Program> kernelForBuildUnit(
List<Uri> sources, CompilerOptions options) async {
- var fs = options.fileSystem;
- report(String msg) {
- options.onError(new SimpleError(msg));
- return null;
- }
-
- if (!options.chaseDependencies) {
- // TODO(sigmund): add support, most likely we can do so by adding a wrapper
- // on top of filesystem that restricts reads to a set of known files.
- report("hermetic mode (chaseDependencies = false) is not implemented");
- return null;
- }
-
- for (var source in sources) {
- if (!await fs.entityForUri(source).exists()) {
- return report("Entry-point file not found: $source");
- }
- }
-
- var pOptions = new ProcessedOptions(options);
-
- if (!await pOptions.validateOptions()) return null;
-
- try {
- TranslateUri uriTranslator = await pOptions.getUriTranslator();
-
- var dillTarget =
- new DillTarget(new Ticker(isVerbose: false), uriTranslator);
- var summary = await pOptions.sdkSummaryProgram;
- if (summary != null) {
- dillTarget.loader.appendLibraries(summary);
- }
-
- // TODO(sigmund): this is likely not going to work if done naively: if
- // summaries contain external references we need to ensure they are loaded
- // in a specific order.
- for (var inputSummary in await pOptions.inputSummariesPrograms) {
- dillTarget.loader.appendLibraries(inputSummary);
- }
-
- await dillTarget.buildOutlines();
-
- var kernelTarget = new KernelTarget(
- options.fileSystem, dillTarget, uriTranslator, options.strongMode);
- sources.forEach(kernelTarget.read);
- await kernelTarget.buildOutlines();
-
- Program program = await kernelTarget.buildProgram(trimDependencies: true);
-
- if (kernelTarget.errors.isNotEmpty) {
- kernelTarget.errors.forEach(report);
- return null;
- }
-
- return program;
- } on InputError catch (e) {
- options.onError(new SimpleError(e.format()));
- return null;
- }
+ throw new UnimplementedError("kernel for build-unit is not implemented");
}
« no previous file with comments | « pkg/front_end/lib/compiler_options.dart ('k') | pkg/front_end/lib/src/base/processed_options.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698