diff --git a/pkg/front_end/lib/src/fasta/incremental_compiler.dart b/pkg/front_end/lib/src/fasta/incremental_compiler.dart index c2ac1800c823e..dedefe9cbaec0 100644 --- a/pkg/front_end/lib/src/fasta/incremental_compiler.dart +++ b/pkg/front_end/lib/src/fasta/incremental_compiler.dart @@ -293,12 +293,14 @@ class IncrementalCompiler implements IncrementalKernelGenerator { userCode.loader.builders[entryPoints.first] != null) { userCode.loader.first = userCode.loader.builders[entryPoints.first]; } - await userCode.buildOutlines(); + Component componentWithDill = await userCode.buildOutlines(); // This is not the full component. It is the component including all // libraries loaded from .dill files. - Component componentWithDill = - await userCode.buildComponent(verify: c.options.verify); + if (!outlineOnly) { + componentWithDill = + await userCode.buildComponent(verify: c.options.verify); + } if (componentWithDill != null) { this.invalidatedUris.clear(); hasToCheckPackageUris = false; diff --git a/pkg/front_end/test/incremental_load_from_dill_test.dart b/pkg/front_end/test/incremental_load_from_dill_test.dart index 4ee035ff73475..1d2d5ca97b52f 100644 --- a/pkg/front_end/test/incremental_load_from_dill_test.dart +++ b/pkg/front_end/test/incremental_load_from_dill_test.dart @@ -33,7 +33,7 @@ import 'package:front_end/src/fasta/severity.dart' show Severity; import 'package:kernel/binary/ast_from_binary.dart' show BinaryBuilder; import 'package:kernel/kernel.dart' - show Class, Component, Field, Library, Procedure; + show Class, Component, EmptyStatement, Field, Library, Procedure; import 'package:kernel/target/targets.dart' show TargetFlags; @@ -405,13 +405,14 @@ Future newWorldTest( entries.add(base.resolve(entry)); } } + bool outlineOnly = world["outlineOnly"] == true; if (brandNewWorld) { if (world["fromComponent"] == true) { compiler = new TestIncrementalCompiler.fromComponent( - options, entries.first, newestWholeComponent); + options, entries.first, newestWholeComponent, outlineOnly); } else { - compiler = - new TestIncrementalCompiler(options, entries.first, initializeFrom); + compiler = new TestIncrementalCompiler( + options, entries.first, initializeFrom, outlineOnly); } } @@ -434,6 +435,18 @@ Future newWorldTest( entryPoints: entries, fullComponent: brandNewWorld ? false : (noFullComponent ? false : true)); + if (outlineOnly) { + for (Library lib in component.libraries) { + for (Class c in lib.classes) { + for (Procedure p in c.procedures) { + if (p.function.body is! EmptyStatement) throw "Got body"; + } + } + for (Procedure p in lib.procedures) { + if (p.function.body is! EmptyStatement) throw "Got body"; + } + } + } performErrorAndWarningCheck( world, gotError, formattedErrors, gotWarning, formattedWarnings); util.throwOnEmptyMixinBodies(component); @@ -808,18 +821,20 @@ class TestIncrementalCompiler extends IncrementalCompiler { } TestIncrementalCompiler(CompilerOptions options, this.entryPoint, - [Uri initializeFrom]) + [Uri initializeFrom, bool outlineOnly]) : super( new CompilerContext( new ProcessedOptions(options: options, inputs: [entryPoint])), - initializeFrom); + initializeFrom, + outlineOnly); TestIncrementalCompiler.fromComponent(CompilerOptions options, - this.entryPoint, Component componentToInitializeFrom) + this.entryPoint, Component componentToInitializeFrom, [bool outlineOnly]) : super.fromComponent( new CompilerContext( new ProcessedOptions(options: options, inputs: [entryPoint])), - componentToInitializeFrom); + componentToInitializeFrom, + outlineOnly); @override void recordInvalidatedImportUrisForTesting(List uris) { diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/outline_only.yaml b/pkg/front_end/testcases/incremental_initialize_from_dill/outline_only.yaml new file mode 100644 index 0000000000000..5bfb458973f88 --- /dev/null +++ b/pkg/front_end/testcases/incremental_initialize_from_dill/outline_only.yaml @@ -0,0 +1,17 @@ +# Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file +# for details. All rights reserved. Use of this source code is governed by a +# BSD-style license that can be found in the LICENSE.md file. + +# Compile an application with the option of only getting an outline. + +type: newworld +strong: true +worlds: + - entry: main.dart + sources: + main.dart: | + main() { + print("hello"); + b(); + } + outlineOnly: true \ No newline at end of file