Skip to content

Commit 5ab0c18

Browse files
scheglovCommit Queue
authored andcommitted
Elements. Remove AugmentedXyzElement classes.
Change-Id: Ia297d63ae6739ca924569dfbf590d70b5e1ebe61 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414540 Reviewed-by: Samuel Rawlins <[email protected]> Reviewed-by: Paul Berry <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent 22f24a2 commit 5ab0c18

File tree

5 files changed

+8
-126
lines changed

5 files changed

+8
-126
lines changed

pkg/analyzer/api.txt

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2992,31 +2992,6 @@ package:analyzer/dart/constant/value.dart:
29922992
toSymbolValue (method: String? Function())
29932993
toTypeValue (method: DartType? Function())
29942994
package:analyzer/dart/element/element.dart:
2995-
AugmentedClassElement (class extends Object implements AugmentedInterfaceElement):
2996-
new (constructor: AugmentedClassElement Function())
2997-
firstFragment (getter: ClassElement)
2998-
AugmentedEnumElement (class extends Object implements AugmentedInterfaceElement):
2999-
new (constructor: AugmentedEnumElement Function())
3000-
constants (getter: List<FieldElement>)
3001-
firstFragment (getter: EnumElement)
3002-
AugmentedExtensionElement (class extends Object implements AugmentedInstanceElement):
3003-
new (constructor: AugmentedExtensionElement Function())
3004-
extendedType (getter: DartType)
3005-
AugmentedExtensionTypeElement (class extends Object implements AugmentedInterfaceElement):
3006-
new (constructor: AugmentedExtensionTypeElement Function())
3007-
firstFragment (getter: ExtensionTypeElement)
3008-
AugmentedInstanceElement (class extends Object):
3009-
new (constructor: AugmentedInstanceElement Function())
3010-
firstFragment (getter: InstanceElement)
3011-
metadata (getter: List<ElementAnnotation>)
3012-
thisType (getter: DartType)
3013-
AugmentedInterfaceElement (class extends Object implements AugmentedInstanceElement):
3014-
new (constructor: AugmentedInterfaceElement Function())
3015-
firstFragment (getter: InterfaceElement)
3016-
thisType (getter: InterfaceType)
3017-
AugmentedMixinElement (class extends AugmentedInterfaceElement):
3018-
new (constructor: AugmentedMixinElement Function())
3019-
superclassConstraints (getter: List<InterfaceType>)
30202995
BindPatternVariableElement (class extends Object implements PatternVariableElement):
30212996
new (constructor: BindPatternVariableElement Function())
30222997
ClassElement (class extends Object implements InterfaceElement):

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

Lines changed: 0 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -59,81 +59,6 @@ import 'package:analyzer/src/task/api/model.dart' show AnalysisTarget;
5959
import 'package:meta/meta.dart';
6060
import 'package:pub_semver/pub_semver.dart';
6161

62-
/// The result of applying augmentations to a [ClassElement].
63-
///
64-
/// Clients may not extend, implement or mix-in this class.
65-
abstract class AugmentedClassElement implements AugmentedInterfaceElement {
66-
@override
67-
ClassElement get firstFragment;
68-
}
69-
70-
/// The result of applying augmentations to an [EnumElement].
71-
///
72-
/// Clients may not extend, implement or mix-in this class.
73-
abstract class AugmentedEnumElement implements AugmentedInterfaceElement {
74-
/// The enum constants declared in this element.
75-
List<FieldElement> get constants;
76-
77-
@override
78-
EnumElement get firstFragment;
79-
}
80-
81-
/// The result of applying augmentations to an [ExtensionElement].
82-
///
83-
/// Clients may not extend, implement or mix-in this class.
84-
abstract class AugmentedExtensionElement implements AugmentedInstanceElement {
85-
/// The type that is extended by this extension.
86-
DartType get extendedType;
87-
}
88-
89-
/// The result of applying augmentations to an [ExtensionTypeElement].
90-
///
91-
/// Clients may not extend, implement or mix-in this class.
92-
abstract class AugmentedExtensionTypeElement
93-
implements AugmentedInterfaceElement {
94-
@override
95-
ExtensionTypeElement get firstFragment;
96-
}
97-
98-
/// The result of applying augmentations to a [InstanceElement].
99-
///
100-
/// Clients may not extend, implement or mix-in this class.
101-
abstract class AugmentedInstanceElement {
102-
/// The declaration (not augmentation) that owns this result.
103-
InstanceElement get firstFragment;
104-
105-
/// The metadata associated with this element.
106-
///
107-
/// This is a union of annotations associated with the class declaration and
108-
/// all its augmentations.
109-
List<ElementAnnotation> get metadata;
110-
111-
/// The type of `this` expression.
112-
DartType get thisType;
113-
}
114-
115-
/// The result of applying augmentations to a [InterfaceElement].
116-
///
117-
/// Clients may not extend, implement or mix-in this class.
118-
abstract class AugmentedInterfaceElement implements AugmentedInstanceElement {
119-
@override
120-
InterfaceElement get firstFragment;
121-
122-
@override
123-
InterfaceType get thisType;
124-
}
125-
126-
/// The result of applying augmentations to a [MixinElement].
127-
///
128-
/// Clients may not extend, implement or mix-in this class.
129-
abstract class AugmentedMixinElement extends AugmentedInterfaceElement {
130-
/// The superclass constraints of this element.
131-
///
132-
/// This is a union of constraints declared by the class declaration and
133-
/// all its augmentations.
134-
List<InterfaceType> get superclassConstraints;
135-
}
136-
13762
/// A pattern variable that is explicitly declared.
13863
///
13964
/// Clients may not extend, implement or mix-in this class.

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

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -585,8 +585,7 @@ class ClassElementImpl extends ClassOrMixinElementImpl
585585
}
586586
}
587587

588-
class ClassElementImpl2 extends InterfaceElementImpl2
589-
implements AugmentedClassElement, ClassElement2 {
588+
class ClassElementImpl2 extends InterfaceElementImpl2 implements ClassElement2 {
590589
@override
591590
final Reference reference;
592591

@@ -3709,8 +3708,7 @@ class EnumElementImpl extends InterfaceElementImpl
37093708
}
37103709
}
37113710

3712-
class EnumElementImpl2 extends InterfaceElementImpl2
3713-
implements AugmentedEnumElement, EnumElement2 {
3711+
class EnumElementImpl2 extends InterfaceElementImpl2 implements EnumElement2 {
37143712
@override
37153713
final Reference reference;
37163714

@@ -3722,11 +3720,6 @@ class EnumElementImpl2 extends InterfaceElementImpl2
37223720
firstFragment.augmentedInternal = this;
37233721
}
37243722

3725-
@override
3726-
List<FieldElementOrMember> get constants {
3727-
return constants2.map((e) => e.asElement).toList();
3728-
}
3729-
37303723
@override
37313724
List<FieldElementImpl2> get constants2 {
37323725
return fields2.where((field) => field.isEnumConstant).toList();
@@ -4135,7 +4128,7 @@ class ExtensionElementImpl extends InstanceElementImpl
41354128

41364129
class ExtensionElementImpl2 extends InstanceElementImpl2
41374130
with _HasSinceSdkVersionMixin
4138-
implements AugmentedExtensionElement, ExtensionElement2 {
4131+
implements ExtensionElement2 {
41394132
@override
41404133
final Reference reference;
41414134

@@ -4241,7 +4234,7 @@ class ExtensionTypeElementImpl extends InterfaceElementImpl
42414234
}
42424235

42434236
class ExtensionTypeElementImpl2 extends InterfaceElementImpl2
4244-
implements AugmentedExtensionTypeElement, ExtensionTypeElement2 {
4237+
implements ExtensionTypeElement2 {
42454238
@override
42464239
final Reference reference;
42474240

@@ -5832,10 +5825,7 @@ abstract class InstanceElementImpl extends _ExistingElementImpl
58325825
}
58335826

58345827
abstract class InstanceElementImpl2 extends ElementImpl2
5835-
implements
5836-
AugmentedInstanceElement,
5837-
InstanceElement2,
5838-
TypeParameterizedElement2 {
5828+
implements InstanceElement2, TypeParameterizedElement2 {
58395829
@override
58405830
InstanceElement2 get baseElement => this;
58415831

@@ -5900,9 +5890,6 @@ abstract class InstanceElementImpl2 extends ElementImpl2
59005890
@override
59015891
LibraryElementImpl get library2 => firstFragment.library2!;
59025892

5903-
@override
5904-
List<ElementAnnotation> get metadata => firstFragment.metadata;
5905-
59065893
@override
59075894
Metadata get metadata2 => firstFragment.metadata2;
59085895

@@ -6547,7 +6534,7 @@ abstract class InterfaceElementImpl extends InstanceElementImpl
65476534

65486535
abstract class InterfaceElementImpl2 extends InstanceElementImpl2
65496536
with _HasSinceSdkVersionMixin
6550-
implements AugmentedInterfaceElement, InterfaceElement2 {
6537+
implements InterfaceElement2 {
65516538
/// The non-nullable instance of this element, without alias.
65526539
/// Should be used only when the element has no type parameters.
65536540
InterfaceTypeImpl? _nonNullableInstance;
@@ -8653,8 +8640,7 @@ class MixinElementImpl extends ClassOrMixinElementImpl
86538640
}
86548641
}
86558642

8656-
class MixinElementImpl2 extends InterfaceElementImpl2
8657-
implements AugmentedMixinElement, MixinElement2 {
8643+
class MixinElementImpl2 extends InterfaceElementImpl2 implements MixinElement2 {
86588644
@override
86598645
final Reference reference;
86608646

pkg/analyzer/lib/src/generated/error_verifier.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
697697
}
698698

699699
if (!declaredFragment.isAugmentation) {
700-
if (element.constants.isEmpty) {
700+
if (element.constants2.isEmpty) {
701701
errorReporter.atToken(
702702
node.name,
703703
CompileTimeErrorCode.ENUM_WITHOUT_CONSTANTS,

pkg/analyzer/test/src/summary/element_text.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2054,10 +2054,6 @@ class _ElementWriter extends _AbstractElementWriter {
20542054
case EnumElementImpl2():
20552055
_elementPrinter.writeTypeList('mixins', element.mixins);
20562056
_elementPrinter.writeTypeList('interfaces', element.interfaces);
2057-
_elementPrinter.writeElementList(
2058-
'constants',
2059-
element.constants.sortedBy((e) => e.name),
2060-
);
20612057
case ExtensionElementImpl2():
20622058
break;
20632059
case ExtensionTypeElementImpl2():

0 commit comments

Comments
 (0)