Remove Kernel-based mixin inference
Change-Id: Id3bb8f66164e55172f892c21a7761e6535cf6619
Reviewed-on: https://dart-review.googlesource.com/c/93426
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
diff --git a/pkg/front_end/lib/src/fasta/kernel/class_hierarchy_builder.dart b/pkg/front_end/lib/src/fasta/kernel/class_hierarchy_builder.dart
index f902c31..d6bb036 100644
--- a/pkg/front_end/lib/src/fasta/kernel/class_hierarchy_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/class_hierarchy_builder.dart
@@ -833,7 +833,6 @@
}
void inferMixinApplication() {
- if (!hierarchy.loader.target.backendTarget.legacyMode) return;
Class kernelClass = cls.target;
Supertype kernelMixedInType = kernelClass.mixedInType;
if (kernelMixedInType == null) return;
diff --git a/pkg/front_end/lib/src/fasta/source/source_loader.dart b/pkg/front_end/lib/src/fasta/source/source_loader.dart
index 05cc836..8f85571 100644
--- a/pkg/front_end/lib/src/fasta/source/source_loader.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_loader.dart
@@ -109,9 +109,6 @@
import '../type_inference/interface_resolver.dart' show InterfaceResolver;
-import '../type_inference/type_inferrer.dart'
- show KernelHierarchyMixinInferrerCallback;
-
import 'diet_listener.dart' show DietListener;
import 'diet_parser.dart' show DietParser;
@@ -798,13 +795,9 @@
};
if (hierarchy == null) {
hierarchy = new ClassHierarchy(computeFullComponent(),
- onAmbiguousSupertypes: onAmbiguousSupertypes,
- mixinInferrer: new KernelHierarchyMixinInferrerCallback(
- this, target.legacyMode));
+ onAmbiguousSupertypes: onAmbiguousSupertypes);
} else {
hierarchy.onAmbiguousSupertypes = onAmbiguousSupertypes;
- hierarchy.mixinInferrer =
- new KernelHierarchyMixinInferrerCallback(this, target.legacyMode);
Component component = computeFullComponent();
hierarchy.applyTreeChanges(const [], component.libraries,
reissueAmbiguousSupertypesFor: component);
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
index d719e07..3de6c94 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
@@ -52,8 +52,6 @@
import 'package:kernel/class_hierarchy.dart' show ClassHierarchy;
-import 'package:kernel/class_hierarchy.dart' as kernel show MixinInferrer;
-
import 'package:kernel/core_types.dart' show CoreTypes;
import 'package:kernel/type_algebra.dart'
@@ -119,8 +117,6 @@
import '../problems.dart' show internalProblem, unexpected, unhandled;
-import '../source/source_loader.dart' show SourceLoader;
-
import 'inference_helper.dart' show InferenceHelper;
import 'interface_resolver.dart' show ForwardingNode, SyntheticAccessor;
@@ -1909,29 +1905,6 @@
}
}
-// TODO(ahe): I'm working on removing this.
-class KernelHierarchyMixinInferrerCallback implements kernel.MixinInferrer {
- final SourceLoader loader;
- final bool legacyMode;
-
- KernelHierarchyMixinInferrerCallback(this.loader, this.legacyMode);
-
- @override
- void infer(ClassHierarchy hierarchy, Class classNode) {
- if (legacyMode) return;
- Supertype mixedInType = classNode.mixedInType;
- List<DartType> typeArguments = mixedInType.typeArguments;
- if (typeArguments.isEmpty || typeArguments.first is! UnknownType) return;
- new KernelHierarchyMixinInferrer(
- hierarchy,
- loader,
- new TypeConstraintGatherer(
- new TypeSchemaEnvironment(loader.coreTypes, hierarchy),
- mixedInType.classNode.typeParameters))
- .infer(classNode);
- }
-}
-
abstract class MixinInferrer {
final CoreTypes coreTypes;
final TypeConstraintGatherer gatherer;
@@ -2074,26 +2047,6 @@
}
}
-// TODO(ahe): I'm working on removing this.
-class KernelHierarchyMixinInferrer extends MixinInferrer {
- final ClassHierarchy hierarchy;
- final SourceLoader loader;
-
- KernelHierarchyMixinInferrer(
- this.hierarchy, this.loader, TypeConstraintGatherer gatherer)
- : super(loader.coreTypes, gatherer);
-
- @override
- Supertype asInstantiationOf(Supertype type, Class superclass) {
- return hierarchy.asInstantiationOf(type, superclass);
- }
-
- @override
- void reportProblem(Message message, Class cls) {
- loader.addProblem(message, cls.fileOffset, noLength, cls.fileUri);
- }
-}
-
/// The result of an expression inference.
class ExpressionInferenceResult {
final Expression expression;