Skip to content

Commit

Permalink
Prepare for non-nullability of InterfaceElement.augmented (#3745)
Browse files Browse the repository at this point in the history
  • Loading branch information
srawlins committed Apr 12, 2024
1 parent 28d0dab commit ba77660
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/src/model/inheriting_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ import 'package:meta/meta.dart';
/// [hasModifiers] override is not necessary for this mixin.
mixin Constructable implements InheritingContainer {
late final List<Constructor> constructors =
// TODO(srawlins): Remove this and deal with the follow-on effects, when
// `.augmented` becomes non-nullable.
// ignore: invalid_null_aware_operator
(element.augmented?.constructors ?? element.constructors)
.map((e) => getModelFor(e, library) as Constructor)
.toList(growable: false);
Expand Down Expand Up @@ -257,6 +260,9 @@ abstract class InheritingContainer extends Container {

@override
late final List<Method> declaredMethods =
// TODO(srawlins): Remove this and deal with the follow-on effects, when
// `.augmented` becomes non-nullable.
// ignore: invalid_null_aware_operator
(element.augmented?.methods ?? element.methods)
.map((e) => getModelFor(e, library) as Method)
.toList(growable: false);
Expand Down Expand Up @@ -599,6 +605,9 @@ extension on InterfaceElement {
/// This element's augmented declaration, or, if there is none, then just this
/// element itself.
InterfaceElement get augmentedDeclarationOrSelf =>
// TODO(srawlins): Remove this and deal with the follow-on effects, when
// `.augmented` becomes non-nullable.
// ignore: invalid_null_aware_operator
augmented?.declaration ?? this;
}

Expand Down
3 changes: 3 additions & 0 deletions lib/src/model/method.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ class Method extends ModelElement
return null;
}
var parent = element.enclosingElement as InterfaceElement;
// TODO(srawlins): Remove this and deal with the follow-on effects, when
// `.augmented` becomes non-nullable.
// ignore: invalid_null_aware_operator
var parentDeclaration = parent.augmented?.declaration ?? parent;
for (var t in parentDeclaration.allSupertypes) {
Element? e = t.getMethod(element.name);
Expand Down

0 comments on commit ba77660

Please sign in to comment.