Skip to content

Commit 34a97d2

Browse files
scheglovCommit Queue
authored andcommitted
Elements. Remove V1 LibraryElement.
Change-Id: I01c41cc34511565cf994c27314f6e41024db8f9d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/423443 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent c9cd6cf commit 34a97d2

File tree

11 files changed

+24
-212
lines changed

11 files changed

+24
-212
lines changed

pkg/analyzer/api.txt

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2968,7 +2968,6 @@ package:analyzer/dart/element/element.dart:
29682968
new (constructor: DirectiveUri Function())
29692969
DirectiveUriWithLibrary (class extends DirectiveUriWithSource):
29702970
new (constructor: DirectiveUriWithLibrary Function())
2971-
library (getter: LibraryElement, deprecated)
29722971
library2 (getter: LibraryElement2)
29732972
DirectiveUriWithRelativeUri (class extends DirectiveUriWithRelativeUriString):
29742973
new (constructor: DirectiveUriWithRelativeUri Function())
@@ -3021,7 +3020,6 @@ package:analyzer/dart/element/element.dart:
30213020
isPublic (getter: bool)
30223021
isSynthetic (getter: bool)
30233022
kind (getter: ElementKind)
3024-
library (getter: LibraryElement?, deprecated)
30253023
location (getter: ElementLocation?)
30263024
metadata (getter: List<ElementAnnotation>)
30273025
name (getter: String?)
@@ -3033,7 +3031,6 @@ package:analyzer/dart/element/element.dart:
30333031
source (getter: Source?)
30343032
getDisplayString (method: String Function({bool multiline, bool withNullability}))
30353033
getExtendedDisplayName (method: String Function(String?))
3036-
isAccessibleIn (method: bool Function(LibraryElement), deprecated)
30373034
thisOrAncestorMatching (method: E? Function<E extends Element>(bool Function(Element)), deprecated)
30383035
thisOrAncestorMatching3 (method: E? Function<E extends Element>(bool Function(Element)), deprecated)
30393036
thisOrAncestorOfType (method: E? Function<E extends Element>(), deprecated)
@@ -3124,24 +3121,6 @@ package:analyzer/dart/element/element.dart:
31243121
HideElementCombinator (class extends Object implements NamespaceCombinator):
31253122
new (constructor: HideElementCombinator Function())
31263123
hiddenNames (getter: List<String>)
3127-
LibraryElement (class extends Object implements _ExistingElement, deprecated):
3128-
new (constructor: LibraryElement Function())
3129-
enclosingElement3 (getter: Null)
3130-
exportNamespace (getter: Namespace)
3131-
featureSet (getter: FeatureSet)
3132-
identifier (getter: String)
3133-
importedLibraries (getter: List<LibraryElement>)
3134-
isDartAsync (getter: bool)
3135-
isDartCore (getter: bool)
3136-
isInSdk (getter: bool)
3137-
languageVersion (getter: LibraryLanguageVersion)
3138-
library (getter: LibraryElement)
3139-
name (getter: String)
3140-
publicNamespace (getter: Namespace)
3141-
session (getter: AnalysisSession)
3142-
topLevelElements (getter: Iterable<Element>)
3143-
typeProvider (getter: TypeProvider)
3144-
typeSystem (getter: TypeSystem)
31453124
LibraryLanguageVersion (class extends Object):
31463125
new (constructor: LibraryLanguageVersion Function({required Version? override, required Version package}))
31473126
effective (getter: Version)
@@ -3163,7 +3142,6 @@ package:analyzer/dart/element/element.dart:
31633142
_ExistingElement (class extends Object implements Element, deprecated):
31643143
new (constructor: _ExistingElement Function())
31653144
declaration (getter: Element, deprecated)
3166-
library (getter: LibraryElement, deprecated)
31673145
librarySource (getter: Source)
31683146
source (getter: Source)
31693147
package:analyzer/dart/element/element2.dart:
@@ -4724,7 +4702,6 @@ package:analyzer/src/dart/constant/evaluation.dart:
47244702
new (constructor: ConstantEvaluationTarget Function())
47254703
context (getter: AnalysisContext@2)
47264704
isConstantEvaluated (getter: bool)
4727-
library (getter: LibraryElement?, deprecated)
47284705
library2 (getter: LibraryElement2?)
47294706
package:analyzer/src/dart/resolver/scope.dart:
47304707
Namespace (class extends Object):

pkg/analyzer/lib/dart/element/element.dart

Lines changed: 0 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,15 @@
3737
library;
3838

3939
import 'package:_fe_analyzer_shared/src/base/analyzer_public_api.dart';
40-
import 'package:analyzer/dart/analysis/features.dart';
4140
import 'package:analyzer/dart/analysis/session.dart';
4241
import 'package:analyzer/dart/constant/value.dart';
4342
import 'package:analyzer/dart/element/element2.dart';
4443
import 'package:analyzer/dart/element/nullability_suffix.dart';
45-
import 'package:analyzer/dart/element/type_provider.dart';
46-
import 'package:analyzer/dart/element/type_system.dart';
4744
import 'package:analyzer/error/error.dart';
4845
import 'package:analyzer/source/source.dart';
4946
import 'package:analyzer/src/dart/constant/evaluation.dart';
5047
import 'package:analyzer/src/dart/element/element.dart'
5148
show elementModelDeprecationMsg;
52-
import 'package:analyzer/src/dart/resolver/scope.dart' show Namespace;
5349
import 'package:analyzer/src/generated/engine.dart' show AnalysisContext;
5450
// ignore: deprecated_member_use_from_same_package
5551
import 'package:analyzer/src/task/api/model.dart' show AnalysisTarget;
@@ -65,10 +61,6 @@ abstract class DirectiveUri {}
6561
///
6662
/// Clients may not extend, implement or mix-in this class.
6763
abstract class DirectiveUriWithLibrary extends DirectiveUriWithSource {
68-
/// The library referenced by the [source].
69-
@Deprecated(elementModelDeprecationMsg)
70-
LibraryElement get library;
71-
7264
/// The library referenced by the [source].
7365
LibraryElement2 get library2;
7466
}
@@ -277,14 +269,6 @@ abstract class Element implements AnalysisTarget {
277269
/// The kind of element that this is.
278270
ElementKind get kind;
279271

280-
/// Library that contains this element.
281-
///
282-
/// This will be the element itself if it is a library element. This will be
283-
/// `null` if this element is [MultiplyDefinedElement2] that is not contained
284-
/// in a library.
285-
@Deprecated(elementModelDeprecationMsg)
286-
LibraryElement? get library;
287-
288272
/// The location of this element in the element model.
289273
///
290274
/// The object can be used to locate this element at a later time.
@@ -371,17 +355,6 @@ abstract class Element implements AnalysisTarget {
371355
// TODO(brianwilkerson): Make the parameter optional.
372356
String getExtendedDisplayName(String? shortName);
373357

374-
/// Whether the element, assuming that it is within scope, is accessible to
375-
/// code in the given [library].
376-
///
377-
/// This is defined by the Dart Language Specification in section 6.2:
378-
/// <blockquote>
379-
/// A declaration <i>m</i> is accessible to a library <i>L</i> if <i>m</i> is
380-
/// declared in <i>L</i> or if <i>m</i> is public.
381-
/// </blockquote>
382-
@Deprecated(elementModelDeprecationMsg)
383-
bool isAccessibleIn(LibraryElement library);
384-
385358
/// Returns either this element or the most immediate ancestor of this element
386359
/// for which the [predicate] returns `true`, or `null` if there is no such
387360
/// element.
@@ -726,73 +699,6 @@ abstract class HideElementCombinator implements NamespaceCombinator {
726699
List<String> get hiddenNames;
727700
}
728701

729-
/// A library.
730-
///
731-
/// Clients may not extend, implement or mix-in this class.
732-
@Deprecated('Use LibraryElement2 instead')
733-
abstract class LibraryElement implements _ExistingElement {
734-
/// Returns `null`, because libraries are the top-level elements in the model.
735-
@override
736-
Null get enclosingElement3;
737-
738-
/// The export [Namespace] of this library.
739-
Namespace get exportNamespace;
740-
741-
/// The set of features available to this library.
742-
///
743-
/// Determined by the combination of the language version for the enclosing
744-
/// package, enabled experiments, and the presence of a `// @dart` language
745-
/// version override comment at the top of the file.
746-
FeatureSet get featureSet;
747-
748-
/// The identifier that uniquely identifies this element among the children
749-
/// of this element's parent.
750-
String get identifier;
751-
752-
/// The libraries that are imported into this library.
753-
///
754-
/// This includes all of the libraries that are imported using a prefix, and
755-
/// those that are imported without a prefix.
756-
List<LibraryElement> get importedLibraries;
757-
758-
/// Whether the library is the `dart:async` library.
759-
bool get isDartAsync;
760-
761-
/// Whether the library is the `dart:core` library.
762-
bool get isDartCore;
763-
764-
/// Whether the library is part of the SDK.
765-
bool get isInSdk;
766-
767-
/// The language version for this library.
768-
LibraryLanguageVersion get languageVersion;
769-
770-
@override
771-
LibraryElement get library;
772-
773-
/// The name of this library, possibly the empty string if this library does
774-
/// not have an explicit name.
775-
@override
776-
String get name;
777-
778-
/// The public [Namespace] of this library.
779-
Namespace get publicNamespace;
780-
781-
@override
782-
AnalysisSession get session;
783-
784-
/// The top-level elements defined in each of the compilation units that are
785-
/// included in this library. This includes both public and private elements,
786-
/// but does not include imports, exports, or synthetic elements.
787-
Iterable<Element> get topLevelElements;
788-
789-
/// The [TypeProvider] that is used in this library.
790-
TypeProvider get typeProvider;
791-
792-
/// The [TypeSystem] that is used in this library.
793-
TypeSystem get typeSystem;
794-
}
795-
796702
class LibraryLanguageVersion {
797703
/// The version for the whole package that contains this library.
798704
final Version package;
@@ -869,10 +775,6 @@ abstract class _ExistingElement implements Element {
869775
@override
870776
Element get declaration;
871777

872-
@Deprecated(elementModelDeprecationMsg)
873-
@override
874-
LibraryElement get library;
875-
876778
@override
877779
Source get librarySource;
878780

pkg/analyzer/lib/src/dart/constant/evaluation.dart

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import 'package:analyzer/dart/analysis/features.dart';
1010
import 'package:analyzer/dart/ast/syntactic_entity.dart';
1111
import 'package:analyzer/dart/ast/token.dart';
1212
import 'package:analyzer/dart/ast/visitor.dart';
13-
import 'package:analyzer/dart/element/element.dart';
1413
import 'package:analyzer/dart/element/element2.dart';
1514
import 'package:analyzer/dart/element/nullability_suffix.dart';
1615
import 'package:analyzer/dart/element/type.dart';
@@ -456,7 +455,7 @@ class ConstantEvaluationEngine {
456455
if (!constructor.isFactory) {
457456
return null;
458457
}
459-
var typeProvider = constructor.library.typeProvider;
458+
var typeProvider = constructor.library2.typeProvider;
460459
if (constructor.asElement2.enclosingElement2 ==
461460
typeProvider.symbolElement2) {
462461
// The dart:core.Symbol has a const factory constructor that redirects
@@ -532,10 +531,6 @@ abstract class ConstantEvaluationTarget extends AnalysisTarget {
532531
/// Return whether this constant is evaluated.
533532
bool get isConstantEvaluated;
534533

535-
/// The library with this constant.
536-
@Deprecated('Use library2 instead')
537-
LibraryElement? get library;
538-
539534
/// The library with this constant.
540535
LibraryElement2? get library2;
541536
}
@@ -2618,7 +2613,7 @@ class _InstanceCreationEvaluator {
26182613

26192614
late final ConstantVisitor _initializerVisitor = ConstantVisitor(
26202615
_evaluationEngine,
2621-
_constructor.library,
2616+
_constructor.library2,
26222617
_externalErrorReporter,
26232618
lexicalEnvironment: _parameterMap,
26242619
lexicalTypeEnvironment: _typeParameterMap,
@@ -3181,7 +3176,7 @@ class _InstanceCreationEvaluator {
31813176
var superclass = definingType.superclass;
31823177
if (superclass != null && !superclass.isDartCoreObject) {
31833178
var superConstructor = superclass
3184-
.lookUpConstructor2(superName, _constructor.library)
3179+
.lookUpConstructor2(superName, _constructor.library2)
31853180
?.asElement;
31863181
if (superConstructor == null) {
31873182
return null;

0 commit comments

Comments
 (0)