Skip to content

Commit d79cb80

Browse files
scheglovCommit Queue
authored andcommitted
Elements. Migrate ElementImpl.enclosingElement3 setters.
Change-Id: I9cf0faca40c095ab460344f4c34d79bfd30b7a96 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418929 Reviewed-by: Paul Berry <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent 15a022b commit d79cb80

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

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

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2545,7 +2545,6 @@ class ElementAnnotationImpl implements ElementAnnotation {
25452545
}
25462546
}
25472547

2548-
/// A base class for concrete implementations of an [Element] or [Element2].
25492548
abstract class ElementImpl implements Element, ElementOrMember {
25502549
static const _metadataFlag_isReady = 1 << 0;
25512550
static const _metadataFlag_hasDeprecated = 1 << 1;
@@ -2628,8 +2627,8 @@ abstract class ElementImpl implements Element, ElementOrMember {
26282627
ElementImpl? get enclosingElement3 => _enclosingElement3;
26292628

26302629
/// Set the enclosing element of this element to the given [element].
2631-
set enclosingElement3(Element? element) {
2632-
_enclosingElement3 = element as ElementImpl?;
2630+
set enclosingElement3(ElementImpl? element) {
2631+
_enclosingElement3 = element;
26332632
}
26342633

26352634
/// Return the enclosing unit element (which might be the same as `this`), or
@@ -3084,9 +3083,8 @@ abstract class ElementImpl implements Element, ElementOrMember {
30843083
}
30853084

30863085
/// Set this element as the enclosing element for given [elements].
3087-
void encloseElements(List<Element> elements) {
3088-
for (Element element in elements) {
3089-
element as ElementImpl;
3086+
void encloseElements(List<ElementImpl> elements) {
3087+
for (var element in elements) {
30903088
element._enclosingElement3 = this;
30913089
}
30923090
}
@@ -3399,11 +3397,11 @@ class ElementLocationImpl implements ElementLocation {
33993397
late final List<String> _components;
34003398

34013399
/// Initialize a newly created location to represent the given [element].
3402-
ElementLocationImpl.con1(Element element) {
3400+
ElementLocationImpl.con1(ElementImpl element) {
34033401
List<String> components = <String>[];
3404-
Element? ancestor = element;
3402+
ElementImpl? ancestor = element;
34053403
while (ancestor != null) {
3406-
components.insert(0, (ancestor as ElementImpl).identifier);
3404+
components.insert(0, ancestor.identifier);
34073405
if (ancestor is CompilationUnitElementImpl) {
34083406
components.insert(0, ancestor.library.identifier);
34093407
break;
@@ -3502,8 +3500,8 @@ class ElementLocationImpl implements ElementLocation {
35023500
}
35033501
}
35043502

3505-
/// A shared internal interface of [Element] and [Member].
3506-
/// Used during migration to avoid referencing [Element].
3503+
/// A shared internal interface of `Element` and [Member].
3504+
/// Used during migration to avoid referencing `Element`.
35073505
abstract class ElementOrMember {}
35083506

35093507
/// An [InterfaceElementImpl] which is an enum.
@@ -7873,7 +7871,7 @@ class LocalVariableElementImpl extends NonParameterVariableElementImpl
78737871
Fragment get enclosingFragment => enclosingElement3 as Fragment;
78747872

78757873
set enclosingFragment(Fragment value) {
7876-
enclosingElement3 = value as Element;
7874+
enclosingElement3 = value as ElementImpl;
78777875
}
78787876

78797877
@override
@@ -8733,7 +8731,7 @@ enum Modifier {
87338731
/// but is used as a library.
87348732
HAS_PART_OF_DIRECTIVE,
87358733

8736-
/// Indicates that the value of [Element.sinceSdkVersion] was computed.
8734+
/// Indicates that the value of [ElementImpl.sinceSdkVersion] was computed.
87378735
HAS_SINCE_SDK_VERSION_COMPUTED,
87388736

87398737
/// [HAS_SINCE_SDK_VERSION_COMPUTED] and the value was not `null`.

0 commit comments

Comments
 (0)