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

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

Issue 2904203003: Don't recreate CoreTypes in transformers. Pass it in. (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
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 2a0f3ffa45332105a4160fb28dcc55377fbe02ec..7841e891ff17949096042281d43e4dfc2458ee12 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
@@ -40,7 +40,6 @@ import 'package:kernel/ast.dart'
VariableGet,
VoidType;
-import 'package:kernel/core_types.dart' show CoreTypes;
import 'package:kernel/transformations/erasure.dart' show Erasure;
import 'package:kernel/transformations/continuation.dart' as transformAsync;
@@ -254,6 +253,10 @@ class KernelTarget extends TargetImplementation {
loader.performInitializerInference();
} on InputError catch (e) {
handleInputError(e, isFullProgram: false);
+ // TODO(scheglov) Normally we create CoreTypes and ClassHierarchy.
+ // But if there is an exception, they are not created, and when we later
+ // blindly continue with buildProgram(), we crash.
+ loader.computeHierarchy(_program);
} catch (e, s) {
return reportCrash(e, s, loader?.currentUriForCrashReporting);
}
@@ -662,7 +665,8 @@ class KernelTarget extends TargetImplementation {
}
void transformMixinApplications() {
- new MixinFullResolution(backendTarget).transform(_program);
+ new MixinFullResolution(backendTarget, loader.coreTypes)
+ .transform(_program);
ticker.logMs("Transformed mixin applications");
}
@@ -672,9 +676,8 @@ class KernelTarget extends TargetImplementation {
_program.accept(new Erasure());
ticker.logMs("Erased type variables in generic methods");
}
- var coreTypes = new CoreTypes(_program);
// TODO(kmillikin): Make this run on a per-method basis.
- transformAsync.transformLibraries(coreTypes, loader.libraries);
+ transformAsync.transformLibraries(loader.coreTypes, loader.libraries);
ticker.logMs("Transformed async methods");
}
@@ -701,7 +704,7 @@ class KernelTarget extends TargetImplementation {
// TODO(sigmund): replace this step with data that is directly computed from
// the builders: we should know the tree-shaking roots without having to do
// a second visit over the tree.
- new RootsMarker(data).run(_program, isIncluded);
+ new RootsMarker(loader.coreTypes, data).run(_program, isIncluded);
trimProgram(_program, data, isIncluded);
}

Powered by Google App Engine
This is Rietveld 408576698