Remove class TypeInferenceEngineImpl

The abstract class TypeInferenceEngineImpl does not really serve any
purpose, so remove it.  If nothing else, it makes it easier to
understand what is going on and change things.

Change-Id: I9aabcb041b3fbc7d5b7b63dfef9effeb73a6bab8
Reviewed-on: https://dart-review.googlesource.com/57822
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
index 36b98a2..f72a8a2 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
@@ -51,8 +51,7 @@
         FieldInitializerInferenceNode,
         IncludesTypeParametersCovariantly,
         InferenceNode,
-        TypeInferenceEngine,
-        TypeInferenceEngineImpl;
+        TypeInferenceEngine;
 
 import '../type_inference/type_inferrer.dart'
     show TypeInferrer, TypeInferrerDisabled, TypeInferrerImpl;
@@ -819,7 +818,7 @@
 
   @override
   void setInferredType(
-      TypeInferenceEngineImpl engine, Uri uri, DartType inferredType) {
+      TypeInferenceEngine engine, Uri uri, DartType inferredType) {
     type = inferredType;
   }
 
@@ -1434,7 +1433,7 @@
   void set _inferenceNode(InferenceNode value);
 
   void setInferredType(
-      TypeInferenceEngineImpl engine, Uri uri, DartType inferredType);
+      TypeInferenceEngine engine, Uri uri, DartType inferredType);
 
   static void resolveInferenceNode(Member member) {
     if (member is ShadowMember) {
@@ -1580,7 +1579,7 @@
 
   @override
   void setInferredType(
-      TypeInferenceEngineImpl engine, Uri uri, DartType inferredType) {
+      TypeInferenceEngine engine, Uri uri, DartType inferredType) {
     if (isSetter) {
       if (function.positionalParameters.length > 0) {
         function.positionalParameters[0].type = inferredType;
@@ -2027,7 +2026,7 @@
 
 /// Concrete implementation of [TypeInferenceEngine] specialized to work with
 /// kernel objects.
-class ShadowTypeInferenceEngine extends TypeInferenceEngineImpl {
+class ShadowTypeInferenceEngine extends TypeInferenceEngine {
   ShadowTypeInferenceEngine(Instrumentation instrumentation, bool strongMode)
       : super(instrumentation, strongMode);
 
diff --git a/pkg/front_end/lib/src/fasta/type_inference/interface_resolver.dart b/pkg/front_end/lib/src/fasta/type_inference/interface_resolver.dart
index 0333163..dd6fb0f 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/interface_resolver.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/interface_resolver.dart
@@ -610,7 +610,7 @@
 /// infer covariance annotations, and to create forwarwding stubs when necessary
 /// to meet covariance requirements.
 class InterfaceResolver {
-  final TypeInferenceEngineImpl _typeInferenceEngine;
+  final TypeInferenceEngine _typeInferenceEngine;
 
   final TypeEnvironment _typeEnvironment;
 
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart
index 49c6214..5a52a48 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart
@@ -37,7 +37,7 @@
 /// Concrete class derived from [InferenceNode] to represent type inference of a
 /// field based on its initializer.
 class FieldInitializerInferenceNode extends InferenceNode {
-  final TypeInferenceEngineImpl _typeInferenceEngine;
+  final TypeInferenceEngine _typeInferenceEngine;
 
   /// The field whose type should be inferred.
   final ShadowField field;
@@ -200,16 +200,24 @@
 /// (e.g. DietListener).  Derived classes should derive from
 /// [TypeInferenceEngineImpl].
 abstract class TypeInferenceEngine {
-  ClassHierarchy get classHierarchy;
+  ClassHierarchy classHierarchy;
 
-  void set classHierarchy(ClassHierarchy classHierarchy);
-
-  CoreTypes get coreTypes;
+  CoreTypes coreTypes;
 
   /// Indicates whether the "prepare" phase of type inference is complete.
-  void set isTypeInferencePrepared(bool value);
+  bool isTypeInferencePrepared = false;
 
-  TypeSchemaEnvironment get typeSchemaEnvironment;
+  TypeSchemaEnvironment typeSchemaEnvironment;
+
+  final staticInferenceNodes = <FieldInitializerInferenceNode>[];
+
+  final initializingFormals = <ShadowVariableDeclaration>[];
+
+  final Instrumentation instrumentation;
+
+  final bool strongMode;
+
+  TypeInferenceEngine(this.instrumentation, this.strongMode);
 
   /// Creates a disabled type inferrer (intended for debugging and profiling
   /// only).
@@ -225,58 +233,13 @@
   TypeInferrer createTopLevelTypeInferrer(
       InterfaceType thisType, ShadowField field);
 
+  /// Retrieve the [TypeInferrer] for the given [field], which was created by
+  /// a previous call to [createTopLevelTypeInferrer].
+  TypeInferrerImpl getFieldTypeInferrer(ShadowField field);
+
   /// Performs the second phase of top level initializer inference, which is to
   /// visit all accessors and top level variables that were passed to
   /// [recordAccessor] in topologically-sorted order and assign their types.
-  void finishTopLevelFields();
-
-  /// Performs the third phase of top level inference, which is to visit all
-  /// initializing formals and infer their types (if necessary) from the
-  /// corresponding fields.
-  void finishTopLevelInitializingFormals();
-
-  /// Gets ready to do top level type inference for the component having the
-  /// given [hierarchy], using the given [coreTypes].
-  void prepareTopLevel(CoreTypes coreTypes, ClassHierarchy hierarchy);
-
-  /// Records that the given initializing [formal] will need top level type
-  /// inference.
-  void recordInitializingFormal(ShadowVariableDeclaration formal);
-
-  /// Records that the given static [field] will need top level type inference.
-  void recordStaticFieldInferenceCandidate(
-      ShadowField field, LibraryBuilder library);
-}
-
-/// Derived class containing generic implementations of
-/// [TypeInferenceEngineImpl].
-///
-/// This class contains as much of the implementation of type inference as
-/// possible without knowing the identity of the type parameter.  It defers to
-/// abstract methods for everything else.
-abstract class TypeInferenceEngineImpl extends TypeInferenceEngine {
-  final Instrumentation instrumentation;
-
-  final bool strongMode;
-
-  final staticInferenceNodes = <FieldInitializerInferenceNode>[];
-
-  final initializingFormals = <ShadowVariableDeclaration>[];
-
-  @override
-  CoreTypes coreTypes;
-
-  @override
-  ClassHierarchy classHierarchy;
-
-  TypeSchemaEnvironment typeSchemaEnvironment;
-
-  @override
-  bool isTypeInferencePrepared = false;
-
-  TypeInferenceEngineImpl(this.instrumentation, this.strongMode);
-
-  @override
   void finishTopLevelFields() {
     for (var node in staticInferenceNodes) {
       node.resolve();
@@ -284,7 +247,9 @@
     staticInferenceNodes.clear();
   }
 
-  @override
+  /// Performs the third phase of top level inference, which is to visit all
+  /// initializing formals and infer their types (if necessary) from the
+  /// corresponding fields.
   void finishTopLevelInitializingFormals() {
     for (ShadowVariableDeclaration formal in initializingFormals) {
       try {
@@ -300,11 +265,8 @@
     }
   }
 
-  /// Retrieve the [TypeInferrer] for the given [field], which was created by
-  /// a previous call to [createTopLevelTypeInferrer].
-  TypeInferrerImpl getFieldTypeInferrer(ShadowField field);
-
-  @override
+  /// Gets ready to do top level type inference for the component having the
+  /// given [hierarchy], using the given [coreTypes].
   void prepareTopLevel(CoreTypes coreTypes, ClassHierarchy hierarchy) {
     this.coreTypes = coreTypes;
     this.classHierarchy = hierarchy;
@@ -312,11 +274,13 @@
         new TypeSchemaEnvironment(coreTypes, hierarchy, strongMode);
   }
 
-  @override
+  /// Records that the given initializing [formal] will need top level type
+  /// inference.
   void recordInitializingFormal(ShadowVariableDeclaration formal) {
     initializingFormals.add(formal);
   }
 
+  /// Records that the given static [field] will need top level type inference.
   void recordStaticFieldInferenceCandidate(
       ShadowField field, LibraryBuilder library) {
     var node = new FieldInitializerInferenceNode(this, field, library);
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 472c8da..b19563b 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
@@ -89,7 +89,7 @@
 import 'type_constraint_gatherer.dart' show TypeConstraintGatherer;
 
 import 'type_inference_engine.dart'
-    show IncludesTypeParametersCovariantly, TypeInferenceEngineImpl;
+    show IncludesTypeParametersCovariantly, TypeInferenceEngine;
 
 import 'type_promotion.dart' show TypePromoter, TypePromoterDisabled;
 
@@ -395,7 +395,7 @@
   static final FunctionType unknownFunction =
       new FunctionType(const [], const DynamicType());
 
-  final TypeInferenceEngineImpl engine;
+  final TypeInferenceEngine engine;
 
   @override
   final Uri uri;