Change SharedRecordType abstract getters to return lists.
Previously these abstract getters were typed as returning iterables. Although in principle, changing the return types to lists constrains the implementations more, in practice it makes no difference because the only implementations are in the CFE, analzyer, and the mini_types shared tests, and those implementations already return lists anyhow. Changing the abstact getters to return lists will simplify future work by allowing code that interacts with the base SharedRecordType class to index into the lists rather than having to iterate through them. Change-Id: Ia257400dbb7c89aabc468be15a939e6baa36e191 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/367500 Commit-Queue: Paul Berry <paulberry@google.com> Reviewed-by: Chloe Stefantsova <cstefantsova@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
@@ -24,9 +24,9 @@ abstract interface class SharedNamedType<Type extends SharedType> {
|
||||
/// represent a record type.
|
||||
abstract interface class SharedRecordType<Type extends SharedType>
|
||||
implements SharedType {
|
||||
Iterable<SharedNamedType<Type>> get namedTypes;
|
||||
List<SharedNamedType<Type>> get namedTypes;
|
||||
|
||||
Iterable<Type> get positionalTypes;
|
||||
List<Type> get positionalTypes;
|
||||
}
|
||||
|
||||
/// Common interface for data structures used by the implementations to
|
||||
|
||||
@@ -1131,7 +1131,7 @@ class RecordTypeImpl extends TypeImpl implements RecordType {
|
||||
String? get name => null;
|
||||
|
||||
@override
|
||||
Iterable<SharedNamedType<DartType>> get namedTypes => namedFields;
|
||||
List<SharedNamedType<DartType>> get namedTypes => namedFields;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
|
||||
@@ -12871,7 +12871,7 @@ class RecordType extends DartType implements SharedRecordType<DartType> {
|
||||
"in a RecordType: ${named}");
|
||||
|
||||
@override
|
||||
Iterable<SharedNamedType<DartType>> get namedTypes => named;
|
||||
List<SharedNamedType<DartType>> get namedTypes => named;
|
||||
|
||||
@override
|
||||
Nullability get nullability => declaredNullability;
|
||||
@@ -12888,7 +12888,7 @@ class RecordType extends DartType implements SharedRecordType<DartType> {
|
||||
};
|
||||
|
||||
@override
|
||||
Iterable<DartType> get positionalTypes => positional;
|
||||
List<DartType> get positionalTypes => positional;
|
||||
|
||||
@override
|
||||
R accept<R>(DartTypeVisitor<R> v) {
|
||||
|
||||
Reference in New Issue
Block a user