Skip to content

Commit 45fa728

Browse files
committed
Elements. Deprecate InterfaceTypeImpl.element
Change-Id: Iff7d90a8d614a6069ec7f13810c8bd6600cfcc1f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418919 Reviewed-by: Phil Quitslund <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent f0b6491 commit 45fa728

File tree

9 files changed

+192
-139
lines changed

9 files changed

+192
-139
lines changed

pkg/analyzer/api.txt

+8-8
Original file line numberDiff line numberDiff line change
@@ -3080,7 +3080,7 @@ package:analyzer/dart/element/element.dart:
30803080
new (constructor: DirectiveUri Function())
30813081
DirectiveUriWithLibrary (class extends DirectiveUriWithSource):
30823082
new (constructor: DirectiveUriWithLibrary Function())
3083-
library (getter: LibraryElement)
3083+
library (getter: LibraryElement, deprecated)
30843084
library2 (getter: LibraryElement2)
30853085
DirectiveUriWithRelativeUri (class extends DirectiveUriWithRelativeUriString):
30863086
new (constructor: DirectiveUriWithRelativeUri Function())
@@ -3097,7 +3097,7 @@ package:analyzer/dart/element/element.dart:
30973097
unit (getter: CompilationUnitElement, deprecated)
30983098
Element (class extends Object implements AnalysisTarget):
30993099
new (constructor: Element Function())
3100-
children (getter: List<Element>)
3100+
children (getter: List<Element>, deprecated)
31013101
context (getter: AnalysisContext@2)
31023102
declaration (getter: Element?)
31033103
displayName (getter: String)
@@ -3135,7 +3135,7 @@ package:analyzer/dart/element/element.dart:
31353135
isPublic (getter: bool)
31363136
isSynthetic (getter: bool)
31373137
kind (getter: ElementKind)
3138-
library (getter: LibraryElement?)
3138+
library (getter: LibraryElement?, deprecated)
31393139
location (getter: ElementLocation?)
31403140
metadata (getter: List<ElementAnnotation>)
31413141
name (getter: String?)
@@ -3148,7 +3148,7 @@ package:analyzer/dart/element/element.dart:
31483148
accept (method: T? Function<T>(ElementVisitor<T>), deprecated)
31493149
getDisplayString (method: String Function({bool multiline, bool withNullability}))
31503150
getExtendedDisplayName (method: String Function(String?))
3151-
isAccessibleIn (method: bool Function(LibraryElement))
3151+
isAccessibleIn (method: bool Function(LibraryElement), deprecated)
31523152
thisOrAncestorMatching (method: E? Function<E extends Element>(bool Function(Element)), deprecated)
31533153
thisOrAncestorMatching3 (method: E? Function<E extends Element>(bool Function(Element)), deprecated)
31543154
thisOrAncestorOfType (method: E? Function<E extends Element>(), deprecated)
@@ -3369,7 +3369,7 @@ package:analyzer/dart/element/element.dart:
33693369
new (constructor: LabelElement Function())
33703370
enclosingElement3 (getter: ExecutableElement, deprecated)
33713371
name (getter: String)
3372-
LibraryElement (class extends Object implements _ExistingElement):
3372+
LibraryElement (class extends Object implements _ExistingElement, deprecated):
33733373
new (constructor: LibraryElement Function())
33743374
definingCompilationUnit (getter: CompilationUnitElement, deprecated)
33753375
enclosingElement3 (getter: Null)
@@ -3520,7 +3520,7 @@ package:analyzer/dart/element/element.dart:
35203520
new (constructor: TypeParameterizedElement Function())
35213521
isSimplyBounded (getter: bool)
35223522
typeParameters (getter: List<TypeParameterElement>, deprecated)
3523-
UndefinedElement (class extends Object implements Element):
3523+
UndefinedElement (class extends Object implements Element, deprecated):
35243524
new (constructor: UndefinedElement Function())
35253525
UriReferencedElement (class extends Object implements _ExistingElement):
35263526
new (constructor: UriReferencedElement Function())
@@ -3541,7 +3541,7 @@ package:analyzer/dart/element/element.dart:
35413541
_ExistingElement (class extends Object implements Element):
35423542
new (constructor: _ExistingElement Function())
35433543
declaration (getter: Element)
3544-
library (getter: LibraryElement)
3544+
library (getter: LibraryElement, deprecated)
35453545
librarySource (getter: Source)
35463546
source (getter: Source)
35473547
package:analyzer/dart/element/element2.dart:
@@ -5260,7 +5260,7 @@ package:analyzer/src/dart/constant/evaluation.dart:
52605260
new (constructor: ConstantEvaluationTarget Function())
52615261
context (getter: AnalysisContext@2)
52625262
isConstantEvaluated (getter: bool)
5263-
library (getter: LibraryElement?)
5263+
library (getter: LibraryElement?, deprecated)
52645264
library2 (getter: LibraryElement2?)
52655265
package:analyzer/src/dart/resolver/scope.dart:
52665266
Namespace (class extends Object):

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

+9-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
/// children of the element representing the class.
2323
///
2424
/// Every complete element structure is rooted by an instance of the class
25+
// ignore:deprecated_member_use_from_same_package
2526
/// [LibraryElement]. A library element represents a single Dart library. Every
2627
/// library is defined by one or more compilation units (the library and all of
2728
/// its parts). The compilation units are represented by the class
@@ -338,11 +339,12 @@ abstract class DeferredImportElementPrefix implements ImportElementPrefix {}
338339
/// Clients may not extend, implement or mix-in this class.
339340
abstract class DirectiveUri {}
340341

341-
/// [DirectiveUriWithSource] that references a [LibraryElement].
342+
/// [DirectiveUriWithSource] that references a [LibraryElement2].
342343
///
343344
/// Clients may not extend, implement or mix-in this class.
344345
abstract class DirectiveUriWithLibrary extends DirectiveUriWithSource {
345346
/// The library referenced by the [source].
347+
@Deprecated('Use library2 instead')
346348
LibraryElement get library;
347349

348350
/// The library referenced by the [source].
@@ -414,6 +416,7 @@ abstract class Element implements AnalysisTarget {
414416
/// A list of this element's children.
415417
///
416418
/// There is no guarantee of the order in which the children will be included.
419+
@Deprecated('Use Element2 instead')
417420
List<Element> get children;
418421

419422
/// The analysis context in which this element is defined.
@@ -566,6 +569,7 @@ abstract class Element implements AnalysisTarget {
566569
/// This will be the element itself if it is a library element. This will be
567570
/// `null` if this element is [MultiplyDefinedElement2] that is not contained
568571
/// in a library.
572+
@Deprecated('Use Element2 instead')
569573
LibraryElement? get library;
570574

571575
/// The location of this element in the element model.
@@ -668,6 +672,7 @@ abstract class Element implements AnalysisTarget {
668672
/// A declaration <i>m</i> is accessible to a library <i>L</i> if <i>m</i> is
669673
/// declared in <i>L</i> or if <i>m</i> is public.
670674
/// </blockquote>
675+
@Deprecated('Use Element2 instead')
671676
bool isAccessibleIn(LibraryElement library);
672677

673678
/// Returns either this element or the most immediate ancestor of this element
@@ -1648,6 +1653,7 @@ abstract class LabelElement implements Element {
16481653
/// A library.
16491654
///
16501655
/// Clients may not extend, implement or mix-in this class.
1656+
@Deprecated('Use LibraryElement2 instead')
16511657
abstract class LibraryElement implements _ExistingElement {
16521658
/// The compilation unit that defines this library.
16531659
@Deprecated(elementModelDeprecationMsg)
@@ -2304,6 +2310,7 @@ abstract class TypeParameterizedElement implements _ExistingElement {
23042310
/// elements do not make sense and will return useless results.
23052311
///
23062312
/// Clients may not extend, implement or mix-in this class.
2313+
@Deprecated('Not used anymore')
23072314
abstract class UndefinedElement implements Element {}
23082315

23092316
/// An element included into a library using some URI.
@@ -2382,6 +2389,7 @@ abstract class _ExistingElement implements Element {
23822389
@override
23832390
Element get declaration;
23842391

2392+
@Deprecated('Use Element2 instead')
23852393
@override
23862394
LibraryElement get library;
23872395

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

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
// ignore_for_file: analyzer_use_new_elements
6-
75
import 'dart:collection';
86

97
import 'package:_fe_analyzer_shared/src/base/analyzer_public_api.dart';
@@ -535,6 +533,7 @@ abstract class ConstantEvaluationTarget extends AnalysisTarget {
535533
bool get isConstantEvaluated;
536534

537535
/// The library with this constant.
536+
@Deprecated('Use library2 instead')
538537
LibraryElement? get library;
539538

540539
/// The library with this constant.
@@ -3171,7 +3170,7 @@ class _InstanceCreationEvaluator {
31713170
var superclass = definingType.superclass;
31723171
if (superclass != null && !superclass.isDartCoreObject) {
31733172
var superConstructor = superclass
3174-
.lookUpConstructor2(superName, _constructor.library.asElement2)
3173+
.lookUpConstructor2(superName, _constructor.library)
31753174
?.asElement;
31763175
if (superConstructor == null) {
31773176
return null;

0 commit comments

Comments
 (0)