analyzer: Remove unnecessary AnalysisTarget

This just seems like an odd parent class for both Element and
ConstantEvaluationTarget. I don't think it carries it's weight (added
complexity).

The abstract AnalysisTarget serves as an interface that adds only two
getters to the contract: `Source? get librarySource` and
`Source? get source`, and is only referenced by two classes: `Element`
implements it, and `ConstantEvaluationTarget` extends it (but it's
abstract anyway).

So to me it seems this is a false type hierarchy; just because Element
and ConstantEvaluationTarget both have a source and a librarySource
field does not mean that it is useful or meaningful to encode this
information in the type hierarchy.

Change-Id: I08ef8e32d3ead6a969950ff34f76baa84272b662
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/399321
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
diff --git a/pkg/analyzer/api.txt b/pkg/analyzer/api.txt
index 56e01bf..404bafe 100644
--- a/pkg/analyzer/api.txt
+++ b/pkg/analyzer/api.txt
@@ -4629,11 +4629,13 @@
     stringForValue (method: String Function(bool))
     toString (method: String Function())
 package:analyzer/src/dart/constant/evaluation.dart:
-  ConstantEvaluationTarget (class extends AnalysisTarget):
+  ConstantEvaluationTarget (class extends Object):
     new (constructor: ConstantEvaluationTarget Function())
     context (getter: AnalysisContext@2)
     isConstantEvaluated (getter: bool)
     library2 (getter: LibraryElement2?)
+    librarySource (getter: Source?)
+    source (getter: Source?)
 package:analyzer/src/dart/resolver/scope.dart:
   Namespace (class extends Object):
     EMPTY (static getter: Namespace)
@@ -4660,11 +4662,6 @@
   RuleConfig (non-public)
 package:analyzer/src/lint/linter.dart:
   LintRule (non-public)
-package:analyzer/src/task/api/model.dart:
-  AnalysisTarget (class extends Object, deprecated):
-    new (constructor: AnalysisTarget Function())
-    librarySource (getter: Source?)
-    source (getter: Source?)
 package:analyzer/src/workspace/workspace.dart:
   Workspace (non-public)
 package:analyzer/utilities/extensions/ast.dart:
diff --git a/pkg/analyzer/lib/src/dart/constant/evaluation.dart b/pkg/analyzer/lib/src/dart/constant/evaluation.dart
index 6682a7b..b992424 100644
--- a/pkg/analyzer/lib/src/dart/constant/evaluation.dart
+++ b/pkg/analyzer/lib/src/dart/constant/evaluation.dart
@@ -14,6 +14,7 @@
 import 'package:analyzer/dart/element/nullability_suffix.dart';
 import 'package:analyzer/dart/element/type.dart';
 import 'package:analyzer/error/listener.dart';
+import 'package:analyzer/source/source.dart';
 import 'package:analyzer/src/dart/ast/ast.dart';
 import 'package:analyzer/src/dart/ast/extensions.dart';
 import 'package:analyzer/src/dart/ast/token.dart';
@@ -32,7 +33,6 @@
 import 'package:analyzer/src/error/codes.dart';
 import 'package:analyzer/src/generated/engine.dart';
 import 'package:analyzer/src/generated/java_core.dart';
-import 'package:analyzer/src/task/api/model.dart';
 import 'package:analyzer/src/utilities/extensions/collection.dart';
 import 'package:analyzer/src/utilities/extensions/element.dart';
 import 'package:analyzer/src/utilities/extensions/object.dart';
@@ -516,14 +516,11 @@
   }
 }
 
-// ignore: deprecated_member_use_from_same_package
-/// Interface for [AnalysisTarget]s for which constant evaluation can be
-/// performed.
+/// Interface for constant evaluation targets.
 @AnalyzerPublicApi(
     message: 'exposed because it is implemented by various elements')
 // TODO(scheglov): consider implementing only in Impl or removing
-// ignore: deprecated_member_use_from_same_package
-abstract class ConstantEvaluationTarget extends AnalysisTarget {
+abstract class ConstantEvaluationTarget {
   /// Return the [AnalysisContext] which should be used to evaluate this
   /// constant.
   AnalysisContext get context;
@@ -533,6 +530,12 @@
 
   /// The library with this constant.
   LibraryElement2? get library2;
+
+  /// The library containing this constant.
+  Source? get librarySource;
+
+  /// The source associated with this constant.
+  Source? get source;
 }
 
 /// A visitor used to evaluate constant expressions to produce their
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index 4b63437..7ed97a8 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -2303,7 +2303,6 @@
   @override
   LibraryElementImpl get library2 => compilationUnit.library;
 
-  /// Get the library containing this annotation.
   @override
   Source get librarySource => compilationUnit.librarySource;
 
diff --git a/pkg/analyzer/lib/src/task/api/model.dart b/pkg/analyzer/lib/src/task/api/model.dart
deleted file mode 100644
index f565d29..0000000
--- a/pkg/analyzer/lib/src/task/api/model.dart
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) 2015, 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 file.
-
-import 'package:_fe_analyzer_shared/src/base/analyzer_public_api.dart';
-import 'package:analyzer/source/source.dart';
-
-/// An object with which an analysis result can be associated.
-///
-/// Clients may implement this class when creating new kinds of targets.
-/// Instances of this type are used in hashed data structures, so subtypes are
-/// required to correctly implement [==] and [hashCode].
-@AnalyzerPublicApi(message: 'exposed by Element (superclass)')
-@Deprecated('To be removed without replacement')
-abstract class AnalysisTarget {
-  /// If this target is associated with a library, return the source of the
-  /// library's defining compilation unit; otherwise return `null`.
-  Source? get librarySource;
-
-  /// Return the source associated with this target, or `null` if this target is
-  /// not associated with a source.
-  Source? get source;
-}