Skip to content

Commit a4171e7

Browse files
scheglovCommit Queue
authored andcommitted
Elements. Remove V1 Element.
Change-Id: Icf4941f3ff2765ea0d5fd7728604c77607327595 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/423447 Commit-Queue: Konstantin Shcheglov <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent 96fe407 commit a4171e7

File tree

9 files changed

+115
-824
lines changed

9 files changed

+115
-824
lines changed

pkg/analyzer/api.txt

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -2981,56 +2981,6 @@ package:analyzer/dart/element/element.dart:
29812981
DirectiveUriWithUnit (class extends DirectiveUriWithSource):
29822982
new (constructor: DirectiveUriWithUnit Function())
29832983
libraryFragment (getter: LibraryFragment, experimental)
2984-
Element (class extends Object implements AnalysisTarget, deprecated):
2985-
new (constructor: Element Function())
2986-
context (getter: AnalysisContext@2)
2987-
declaration (getter: Element?, deprecated)
2988-
displayName (getter: String)
2989-
documentationComment (getter: String?)
2990-
enclosingElement3 (getter: Element?, deprecated)
2991-
hasAlwaysThrows (getter: bool)
2992-
hasDeprecated (getter: bool)
2993-
hasDoNotStore (getter: bool)
2994-
hasDoNotSubmit (getter: bool)
2995-
hasFactory (getter: bool)
2996-
hasImmutable (getter: bool)
2997-
hasInternal (getter: bool)
2998-
hasIsTest (getter: bool)
2999-
hasIsTestGroup (getter: bool)
3000-
hasJS (getter: bool)
3001-
hasLiteral (getter: bool)
3002-
hasMustBeConst (getter: bool)
3003-
hasMustBeOverridden (getter: bool)
3004-
hasMustCallSuper (getter: bool)
3005-
hasNonVirtual (getter: bool)
3006-
hasOptionalTypeArgs (getter: bool)
3007-
hasOverride (getter: bool)
3008-
hasProtected (getter: bool)
3009-
hasRedeclare (getter: bool)
3010-
hasReopen (getter: bool)
3011-
hasRequired (getter: bool)
3012-
hasSealed (getter: bool)
3013-
hasUseResult (getter: bool)
3014-
hasVisibleForOverriding (getter: bool)
3015-
hasVisibleForTemplate (getter: bool)
3016-
hasVisibleForTesting (getter: bool)
3017-
hasVisibleOutsideTemplate (getter: bool)
3018-
id (getter: int)
3019-
isPrivate (getter: bool)
3020-
isPublic (getter: bool)
3021-
isSynthetic (getter: bool)
3022-
kind (getter: ElementKind)
3023-
location (getter: ElementLocation?)
3024-
metadata (getter: List<ElementAnnotation>)
3025-
name (getter: String?)
3026-
nameLength (getter: int)
3027-
nameOffset (getter: int)
3028-
nonSynthetic (getter: Element, deprecated)
3029-
session (getter: AnalysisSession?)
3030-
sinceSdkVersion (getter: Version?)
3031-
source (getter: Source?)
3032-
getDisplayString (method: String Function({bool multiline, bool withNullability}))
3033-
getExtendedDisplayName (method: String Function(String?))
30342984
ElementAnnotation (class extends Object implements ConstantEvaluationTarget):
30352985
new (constructor: ElementAnnotation Function())
30362986
constantEvaluationErrors (getter: List<AnalysisError>?)

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

Lines changed: 0 additions & 264 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,11 @@
3636
/// represented by an element.
3737
library;
3838

39-
import 'package:analyzer/dart/analysis/session.dart';
4039
import 'package:analyzer/dart/constant/value.dart';
4140
import 'package:analyzer/dart/element/element2.dart';
42-
import 'package:analyzer/dart/element/nullability_suffix.dart';
4341
import 'package:analyzer/error/error.dart';
4442
import 'package:analyzer/source/source.dart';
4543
import 'package:analyzer/src/dart/constant/evaluation.dart';
46-
import 'package:analyzer/src/dart/element/element.dart'
47-
show elementModelDeprecationMsg;
48-
import 'package:analyzer/src/generated/engine.dart' show AnalysisContext;
49-
// ignore: deprecated_member_use_from_same_package
50-
import 'package:analyzer/src/task/api/model.dart' show AnalysisTarget;
5144
import 'package:meta/meta.dart';
5245
import 'package:pub_semver/pub_semver.dart';
5346

@@ -98,263 +91,6 @@ abstract class DirectiveUriWithUnit extends DirectiveUriWithSource {
9891
LibraryFragment get libraryFragment;
9992
}
10093

101-
/// The base class for all of the elements in the element model. Generally
102-
/// speaking, the element model is a semantic model of the program that
103-
/// represents things that are declared with a name and hence can be referenced
104-
/// elsewhere in the code.
105-
///
106-
/// There are two exceptions to the general case. First, there are elements in
107-
/// the element model that are created for the convenience of various kinds of
108-
/// analysis but that do not have any corresponding declaration within the
109-
/// source code. Such elements are marked as being <i>synthetic</i>. Examples of
110-
/// synthetic elements include
111-
/// * default constructors in classes that do not define any explicit
112-
/// constructors,
113-
/// * getters and setters that are induced by explicit field declarations,
114-
/// * fields that are induced by explicit declarations of getters and setters,
115-
/// and
116-
/// * functions representing the initialization expression for a variable.
117-
///
118-
/// Second, there are elements in the element model that do not have a name.
119-
/// These correspond to unnamed functions and exist in order to more accurately
120-
/// represent the semantic structure of the program.
121-
///
122-
/// Clients may not extend, implement or mix-in this class.
123-
@Deprecated(elementModelDeprecationMsg)
124-
abstract class Element implements AnalysisTarget {
125-
/// The analysis context in which this element is defined.
126-
AnalysisContext get context;
127-
128-
/// The declaration of this element.
129-
///
130-
/// If the element is a view on an element, e.g. a method from an interface
131-
/// type, with substituted type parameters, return the corresponding element
132-
/// from the class, without any substitutions. If this element is already a
133-
/// declaration (or a synthetic element, e.g. a synthetic property accessor),
134-
/// return itself.
135-
@Deprecated(elementModelDeprecationMsg)
136-
Element? get declaration;
137-
138-
/// The display name of this element, possibly the empty string if the
139-
/// element does not have a name.
140-
///
141-
/// In most cases the name and the display name are the same. Differences
142-
/// though are cases such as setters where the name of some setter `set f(x)`
143-
/// is `f=`, instead of `f`.
144-
String get displayName;
145-
146-
/// The content of the documentation comment (including delimiters) for this
147-
/// element, or `null` if this element does not or cannot have documentation.
148-
String? get documentationComment;
149-
150-
/// The element that either physically or logically encloses this element.
151-
///
152-
/// For [LibraryElement] returns `null`, because libraries are the top-level
153-
/// elements in the model.
154-
///
155-
/// For [CompilationUnitElement] returns the [CompilationUnitElement] that
156-
/// uses `part` directive to include this element, or `null` if this element
157-
/// is the defining unit of the library.
158-
@Deprecated('Use Element2.enclosingElement2 instead or '
159-
'Fragment.enclosingFragment instead')
160-
Element? get enclosingElement3;
161-
162-
/// Whether the element has an annotation of the form `@alwaysThrows`.
163-
bool get hasAlwaysThrows;
164-
165-
/// Whether the element has an annotation of the form `@deprecated`
166-
/// or `@Deprecated('..')`.
167-
bool get hasDeprecated;
168-
169-
/// Whether the element has an annotation of the form `@doNotStore`.
170-
bool get hasDoNotStore;
171-
172-
/// Whether the element has an annotation of the form `@doNotSubmit`.
173-
bool get hasDoNotSubmit;
174-
175-
/// Whether the element has an annotation of the form `@factory`.
176-
bool get hasFactory;
177-
178-
/// Whether the element has an annotation of the form `@immutable`.
179-
bool get hasImmutable;
180-
181-
/// Whether the element has an annotation of the form `@internal`.
182-
bool get hasInternal;
183-
184-
/// Whether the element has an annotation of the form `@isTest`.
185-
bool get hasIsTest;
186-
187-
/// Whether the element has an annotation of the form `@isTestGroup`.
188-
bool get hasIsTestGroup;
189-
190-
/// Whether the element has an annotation of the form `@JS(..)`.
191-
bool get hasJS;
192-
193-
/// Whether the element has an annotation of the form `@literal`.
194-
bool get hasLiteral;
195-
196-
/// Whether the element has an annotation of the form `@mustBeConst`.
197-
bool get hasMustBeConst;
198-
199-
/// Whether the element has an annotation of the form `@mustBeOverridden`.
200-
bool get hasMustBeOverridden;
201-
202-
/// Whether the element has an annotation of the form `@mustCallSuper`.
203-
bool get hasMustCallSuper;
204-
205-
/// Whether the element has an annotation of the form `@nonVirtual`.
206-
bool get hasNonVirtual;
207-
208-
/// Whether the element has an annotation of the form `@optionalTypeArgs`.
209-
bool get hasOptionalTypeArgs;
210-
211-
/// Whether the element has an annotation of the form `@override`.
212-
bool get hasOverride;
213-
214-
/// Whether the element has an annotation of the form `@protected`.
215-
bool get hasProtected;
216-
217-
/// Whether the element has an annotation of the form `@redeclare`.
218-
bool get hasRedeclare;
219-
220-
/// Whether the element has an annotation of the form `@reopen`.
221-
bool get hasReopen;
222-
223-
/// Whether the element has an annotation of the form `@required`.
224-
bool get hasRequired;
225-
226-
/// Whether the element has an annotation of the form `@sealed`.
227-
bool get hasSealed;
228-
229-
/// Whether the element has an annotation of the form `@useResult`
230-
/// or `@UseResult('..')`.
231-
bool get hasUseResult;
232-
233-
/// Whether the element has an annotation of the form `@visibleForOverriding`.
234-
bool get hasVisibleForOverriding;
235-
236-
/// Whether the element has an annotation of the form `@visibleForTemplate`.
237-
bool get hasVisibleForTemplate;
238-
239-
/// Whether the element has an annotation of the form `@visibleForTesting`.
240-
bool get hasVisibleForTesting;
241-
242-
/// Whether the element has an annotation of the form
243-
/// `@visibleOutsideTemplate`.
244-
bool get hasVisibleOutsideTemplate;
245-
246-
/// The unique integer identifier of this element.
247-
int get id;
248-
249-
/// Whether the element is private.
250-
///
251-
/// Private elements are visible only within the library in which they are
252-
/// declared.
253-
bool get isPrivate;
254-
255-
/// Whether the element is public.
256-
///
257-
/// Public elements are visible within any library that imports the library
258-
/// in which they are declared.
259-
bool get isPublic;
260-
261-
/// Whether the element is synthetic.
262-
///
263-
/// A synthetic element is an element that is not represented in the source
264-
/// code explicitly, but is implied by the source code, such as the default
265-
/// constructor for a class that does not explicitly define any constructors.
266-
bool get isSynthetic;
267-
268-
/// The kind of element that this is.
269-
ElementKind get kind;
270-
271-
/// The location of this element in the element model.
272-
///
273-
/// The object can be used to locate this element at a later time.
274-
ElementLocation? get location;
275-
276-
/// All of the metadata associated with this element.
277-
///
278-
/// The array will be empty if the element does not have any metadata or if
279-
/// the library containing this element has not yet been resolved.
280-
List<ElementAnnotation> get metadata;
281-
282-
/// The name of this element, or `null` if this element does not have a name.
283-
String? get name;
284-
285-
/// The length of the name of this element in the file that contains the
286-
/// declaration of this element, or `0` if this element does not have a name.
287-
int get nameLength;
288-
289-
/// The offset of the name of this element in the file that contains the
290-
/// declaration of this element, or `-1` if this element is synthetic, does
291-
/// not have a name, or otherwise does not have an offset.
292-
int get nameOffset;
293-
294-
/// The non-synthetic element that caused this element to be created.
295-
///
296-
/// If this element is not synthetic, then the element itself is returned.
297-
///
298-
/// If this element is synthetic, then the corresponding non-synthetic
299-
/// element is returned. For example, for a synthetic getter of a
300-
/// non-synthetic field the field is returned; for a synthetic constructor
301-
/// the enclosing class is returned.
302-
@Deprecated(elementModelDeprecationMsg)
303-
Element get nonSynthetic;
304-
305-
/// The analysis session in which this element is defined.
306-
AnalysisSession? get session;
307-
308-
/// The version where this SDK API was added.
309-
///
310-
/// A `@Since()` annotation can be applied to a library declaration,
311-
/// any public declaration in a library, or in a class, or to an optional
312-
/// parameter, etc.
313-
///
314-
/// The returned version is "effective", so that if a library is annotated
315-
/// then all elements of the library inherit it; or if a class is annotated
316-
/// then all members and constructors of the class inherit it.
317-
///
318-
/// If multiple `@Since()` annotations apply to the same element, the latest
319-
/// version takes precedence.
320-
///
321-
/// Returns `null` if the element is not declared in SDK, or does not have
322-
/// a `@Since()` annotation applicable to it.
323-
Version? get sinceSdkVersion;
324-
325-
@override
326-
Source? get source;
327-
328-
/// Returns the presentation of this element as it should appear when
329-
/// presented to users.
330-
///
331-
/// If [withNullability] is `true`, then [NullabilitySuffix.question] and
332-
/// [NullabilitySuffix.star] in types will be represented as `?` and `*`.
333-
/// [NullabilitySuffix.none] does not have any explicit presentation.
334-
///
335-
/// If [withNullability] is `false`, nullability suffixes will not be
336-
/// included into the presentation.
337-
///
338-
/// If [multiline] is `true`, the string may be wrapped over multiple lines
339-
/// with newlines to improve formatting. For example function signatures may
340-
/// be formatted as if they had trailing commas.
341-
///
342-
/// Clients should not depend on the content of the returned value as it will
343-
/// be changed if doing so would improve the UX.
344-
String getDisplayString({
345-
@Deprecated('Only non-nullable by default mode is supported')
346-
bool withNullability = true,
347-
bool multiline = false,
348-
});
349-
350-
/// Returns a display name for the given element that includes the path to the
351-
/// compilation unit in which the type is defined. If [shortName] is `null`
352-
/// then [displayName] will be used as the name of this element. Otherwise
353-
/// the provided name will be used.
354-
// TODO(brianwilkerson): Make the parameter optional.
355-
String getExtendedDisplayName(String? shortName);
356-
}
357-
35894
/// A single annotation associated with an element.
35995
///
36096
/// Clients may not extend, implement or mix-in this class.

0 commit comments

Comments
 (0)