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

Unified Diff: pkg/front_end/lib/src/fasta/kernel/kernel_target.dart

Issue 2919003003: Reapply "Use backend targets to run Kernel transformations in Fasta" (Closed)
Patch Set: Follow dartanalyzer suggestions 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
Index: pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
index b4e3eee32c465142118f3323edb6cc66e165fdad..798e61b7ce04a51a4981d5b0588d6af8e029b6d5 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
@@ -40,12 +40,6 @@ import 'package:kernel/ast.dart'
VariableGet,
VoidType;
-import 'package:kernel/transformations/erasure.dart' show Erasure;
-
-import 'package:kernel/transformations/continuation.dart' as transformAsync;
-
-import 'package:kernel/transformations/mixin_full_resolution.dart' as mix;
-
import 'package:kernel/type_algebra.dart' show substitute;
import '../source/source_loader.dart' show SourceLoader;
@@ -89,8 +83,6 @@ class KernelTarget extends TargetImplementation {
/// The [FileSystem] which should be used to access files.
final FileSystem fileSystem;
- final bool strongMode;
-
final DillTarget dillTarget;
/// Shared with [CompilerContext].
@@ -105,8 +97,10 @@ class KernelTarget extends TargetImplementation {
final TypeBuilder dynamicType =
new KernelNamedTypeBuilder("dynamic", null, -1, null);
- KernelTarget(this.fileSystem, DillTarget dillTarget,
- TranslateUri uriTranslator, this.strongMode,
+ bool get strongMode => backendTarget.strongMode;
+
+ KernelTarget(
+ this.fileSystem, DillTarget dillTarget, TranslateUri uriTranslator,
[Map<String, Source> uriToSource])
: dillTarget = dillTarget,
uriToSource = uriToSource ?? CompilerContext.current.uriToSource,
@@ -655,27 +649,11 @@ class KernelTarget extends TargetImplementation {
/// Run all transformations that are needed when building a program for the
/// first time.
void runBuildTransformations() {
- transformMixinApplications();
- otherTransformations();
- }
-
- void transformMixinApplications() {
- mix.transformLibraries(
- backendTarget, loader.coreTypes, loader.hierarchy, loader.libraries);
- ticker.logMs("Transformed mixin applications");
- }
-
- void otherTransformations() {
- if (!strongMode) {
- // TODO(ahe): Don't generate type variables in the first place.
- program.accept(new Erasure());
- ticker.logMs("Erased type variables in generic methods");
- }
- if (errors.isEmpty && loader.collectCompileTimeErrors().isEmpty) {
- // TODO(kmillikin): Make this run on a per-method basis.
- transformAsync.transformLibraries(loader.coreTypes, loader.libraries);
- }
- ticker.logMs("Transformed async methods");
+ backendTarget.performModularTransformationsOnLibraries(
+ loader.coreTypes, loader.hierarchy, loader.libraries,
+ logger: (String msg) => ticker.logMs(msg));
+ backendTarget.performGlobalTransformations(loader.coreTypes, program,
+ logger: (String msg) => ticker.logMs(msg));
}
void verify() {

Powered by Google App Engine
This is Rietveld 408576698