Skip to content

Commit aadf532

Browse files
scheglovCommit Queue
authored andcommitted
Elements. Remove V1 InstanceElement.
Change-Id: I8233c89aa693101dc65fd8c0b75666ab35a04545 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/423205 Commit-Queue: Konstantin Shcheglov <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent 7e40b7c commit aadf532

File tree

5 files changed

+17
-65
lines changed

5 files changed

+17
-65
lines changed

pkg/analyzer/api.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3186,14 +3186,6 @@ package:analyzer/dart/element/element.dart:
31863186
ImportElementPrefix (class extends Object, deprecated):
31873187
new (constructor: ImportElementPrefix Function())
31883188
element (getter: PrefixElement)
3189-
InstanceElement (class extends Object implements TypeDefiningElement, TypeParameterizedElement, deprecated):
3190-
new (constructor: InstanceElement Function())
3191-
accessors (getter: List<PropertyAccessorElement>)
3192-
enclosingElement3 (getter: CompilationUnitElement, deprecated)
3193-
fields (getter: List<FieldElement>)
3194-
isAugmentation (getter: bool)
3195-
methods (getter: List<MethodElement>)
3196-
thisType (getter: DartType)
31973189
JoinPatternVariableElement (class extends Object implements PatternVariableElement, deprecated):
31983190
new (constructor: JoinPatternVariableElement Function())
31993191
isConsistent (getter: bool)

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

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -955,36 +955,6 @@ abstract class ImportElementPrefix {
955955
PrefixElement get element;
956956
}
957957

958-
/// An element that has `this`.
959-
///
960-
/// Clients may not extend, implement or mix-in this class.
961-
@Deprecated('Use InstanceElement2 instead')
962-
abstract class InstanceElement
963-
implements TypeDefiningElement, TypeParameterizedElement {
964-
/// The declared accessors (getters and setters).
965-
List<PropertyAccessorElement> get accessors;
966-
967-
@Deprecated(elementModelDeprecationMsg)
968-
@override
969-
CompilationUnitElement get enclosingElement3;
970-
971-
/// The declared fields.
972-
List<FieldElement> get fields;
973-
974-
/// Whether the element is an augmentation.
975-
///
976-
/// If `true`, declaration has the explicit `augment` modifier.
977-
bool get isAugmentation;
978-
979-
/// The declared methods.
980-
List<MethodElement> get methods;
981-
982-
/// The type of `this` expression.
983-
///
984-
/// Same as `augmented.thisType`.
985-
DartType get thisType;
986-
}
987-
988958
/// A pattern variable that is a join of other pattern variables, created
989959
/// for a logical-or patterns, or shared `case` bodies in `switch` statements.
990960
///

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

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,8 +1419,7 @@ class ConstructorElementImpl extends ExecutableElementImpl
14191419
return result as InterfaceTypeImpl;
14201420
}
14211421

1422-
var augmentedDeclaration = enclosingElement3.element.firstFragment;
1423-
result = augmentedDeclaration.thisType;
1422+
result = enclosingElement3.element.thisType;
14241423
return _returnType = result as InterfaceTypeImpl;
14251424
}
14261425

@@ -3815,9 +3814,6 @@ class ExtensionElementImpl extends InstanceElementImpl
38153814
ExtensionElementImpl? get previousFragment =>
38163815
super.previousFragment as ExtensionElementImpl?;
38173816

3818-
@override
3819-
DartType get thisType => extendedType;
3820-
38213817
@override
38223818
void appendTo(ElementDisplayStringBuilder builder) {
38233819
builder.writeExtensionElement(this);
@@ -5385,13 +5381,8 @@ class ImportElementPrefixImpl
53855381
}
53865382

53875383
abstract class InstanceElementImpl extends _ExistingElementImpl
5388-
with
5389-
AugmentableFragment,
5390-
TypeParameterizedElementMixin
5391-
implements
5392-
// ignore:deprecated_member_use_from_same_package,analyzer_use_new_elements
5393-
InstanceElement,
5394-
InstanceFragment {
5384+
with AugmentableFragment, TypeParameterizedElementMixin
5385+
implements InstanceFragment {
53955386
@override
53965387
ElementLinkedData? linkedData;
53975388

@@ -5416,7 +5407,7 @@ abstract class InstanceElementImpl extends _ExistingElementImpl
54165407

54175408
InstanceElementImpl(super.name, super.nameOffset);
54185409

5419-
@override
5410+
/// The declared accessors (getters and setters).
54205411
List<PropertyAccessorElementImpl> get accessors {
54215412
if (!identical(_accessors, _Sentinel.propertyAccessorElement)) {
54225413
return _accessors;
@@ -5444,7 +5435,7 @@ abstract class InstanceElementImpl extends _ExistingElementImpl
54445435
@override
54455436
LibraryFragment? get enclosingFragment => enclosingElement3;
54465437

5447-
@override
5438+
/// The declared fields.
54485439
List<FieldElementImpl> get fields {
54495440
if (!identical(_fields, _Sentinel.fieldElement)) {
54505441
return _fields;
@@ -5474,7 +5465,7 @@ abstract class InstanceElementImpl extends _ExistingElementImpl
54745465
return super.metadata;
54755466
}
54765467

5477-
@override
5468+
/// The declared methods.
54785469
List<MethodElementImpl> get methods {
54795470
if (!identical(_methods, _Sentinel.methodElement)) {
54805471
return _methods;
@@ -5922,11 +5913,6 @@ abstract class InterfaceElementImpl extends InstanceElementImpl
59225913
_supertype = value as InterfaceTypeImpl?;
59235914
}
59245915

5925-
@override
5926-
InterfaceTypeImpl get thisType {
5927-
return element.thisType;
5928-
}
5929-
59305916
InterfaceTypeImpl instantiateImpl({
59315917
required List<TypeImpl> typeArguments,
59325918
required NullabilitySuffix nullabilitySuffix,

pkg/analyzer/lib/src/summary2/types_builder.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ class _MixinInference {
406406
_MixinInference(this.element, this.featureSet,
407407
{required this.typeSystemOperations})
408408
: typeSystem = element.library.typeSystem,
409-
classType = element.thisType {
409+
classType = element.element.thisType {
410410
interfacesMerger = InterfacesMerger(typeSystem);
411411
interfacesMerger.addWithSupertypes(element.supertype);
412412
}

pkg/analyzer/test/src/dart/element/function_type_test.dart

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,8 @@ class FunctionTypeTest extends AbstractTypeSystemTest {
260260

261261
test_hash_nullabilitySuffix() {
262262
_testHashesSometimesDifferPairwise((i) {
263-
var c = class_(name: 'C$i');
263+
var cf = class_(name: 'C$i');
264+
var c = cf.element;
264265
return (
265266
FunctionTypeImpl(
266267
typeFormals: const [],
@@ -294,7 +295,8 @@ class FunctionTypeTest extends AbstractTypeSystemTest {
294295
_testHashesSometimesDiffer((i) => FunctionTypeImpl(
295296
typeFormals: const [],
296297
parameters: [
297-
namedParameter(name: 'x', type: class_(name: 'C$i').thisType)
298+
namedParameter(
299+
name: 'x', type: class_(name: 'C$i').element.thisType)
298300
.asElement
299301
],
300302
returnType: typeProvider.voidType,
@@ -317,7 +319,8 @@ class FunctionTypeTest extends AbstractTypeSystemTest {
317319
_testHashesAlwaysEqual((i) => FunctionTypeImpl(
318320
typeFormals: const [],
319321
parameters: [
320-
positionalParameter(name: 'x', type: class_(name: 'C$i').thisType)
322+
positionalParameter(
323+
name: 'x', type: class_(name: 'C$i').element.thisType)
321324
.asElement
322325
],
323326
returnType: typeProvider.voidType,
@@ -361,7 +364,7 @@ class FunctionTypeTest extends AbstractTypeSystemTest {
361364
typeFormals: const [],
362365
parameters: [
363366
namedRequiredParameter(
364-
name: 'x', type: class_(name: 'C$i').thisType)
367+
name: 'x', type: class_(name: 'C$i').element.thisType)
365368
.asElement
366369
],
367370
returnType: typeProvider.voidType,
@@ -384,7 +387,8 @@ class FunctionTypeTest extends AbstractTypeSystemTest {
384387
_testHashesAlwaysEqual((i) => FunctionTypeImpl(
385388
typeFormals: const [],
386389
parameters: [
387-
requiredParameter(name: 'x', type: class_(name: 'C$i').thisType)
390+
requiredParameter(
391+
name: 'x', type: class_(name: 'C$i').element.thisType)
388392
.asElement
389393
],
390394
returnType: typeProvider.voidType,
@@ -395,7 +399,7 @@ class FunctionTypeTest extends AbstractTypeSystemTest {
395399
_testHashesSometimesDiffer((i) => FunctionTypeImpl(
396400
typeFormals: const [],
397401
parameters: const [],
398-
returnType: class_(name: 'C$i').thisType,
402+
returnType: class_(name: 'C$i').element.thisType,
399403
nullabilitySuffix: NullabilitySuffix.none));
400404
}
401405

0 commit comments

Comments
 (0)