Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/src/element_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ abstract class ElementType with CommentReferable, Nameable {
factory ElementType.for_(
DartType type, Library library, PackageGraph packageGraph) {
runtimeStats.incrementAccumulator('elementTypeInstantiation');
var fElement = type.documentableElement2;
var fElement = type.documentableElement;
if (fElement == null ||
fElement.kind == ElementKind.DYNAMIC ||
fElement.kind == ElementKind.NEVER) {
Expand Down Expand Up @@ -102,9 +102,9 @@ class UndefinedElementType extends ElementType {
// We can not simply throw here because not all SDK libraries resolve
// all types.
if (type is InvalidType) return 'dynamic';
assert(const {'Never'}.contains(type.documentableElement2?.name),
assert(const {'Never'}.contains(type.documentableElement?.name),
'Unrecognized type for UndefinedElementType: $type');
return type.documentableElement2!.name!;
return type.documentableElement!.name!;
}

@override
Expand Down Expand Up @@ -288,7 +288,7 @@ abstract class DefinedElementType extends ElementType {
}

@override
String get name => type.documentableElement2!.name!;
String get name => type.documentableElement!.name!;

@override
String get fullyQualifiedName => modelElement.fullyQualifiedName;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/model/model_element.dart
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ abstract class ModelElement
TypeAliasElement(aliasedType: FunctionType()) =>
FunctionTypedef(e, library, packageGraph),
TypeAliasElement()
when e.aliasedType.documentableElement2 is InterfaceElement =>
when e.aliasedType.documentableElement is InterfaceElement =>
ClassTypedef(e, library, packageGraph),
TypeAliasElement() => GeneralizedTypedef(e, library, packageGraph),
MethodElement(isOperator: true) when enclosingContainer == null =>
Expand Down
6 changes: 3 additions & 3 deletions lib/src/type_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';

extension DartTypeExtension on DartType {
/// The static element associataed with this type, where documentable, and
/// The static element associated with this type, where documentable, and
/// `null` otherwise.
///
/// For example, the documentable element of [DynamicType] is `null`, as there
/// is no documentation for `dynamic` which we can link to.
TypeDefiningElement? get documentableElement2 {
Element? get documentableElement {
final self = this;
return switch (self) {
InterfaceType() => self.element,
NeverType() => self.element as TypeDefiningElement,
NeverType() => self.element,
TypeParameterType() => self.element,
_ => null
};
Expand Down
2 changes: 1 addition & 1 deletion tool/mustachio/codegen_aot_compiler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ extension on StringBuffer {
if (bound == null) {
write(typeParameter.name);
} else {
var boundElement = bound.documentableElement2!;
var boundElement = bound.documentableElement!;
referencedElements.add(boundElement);
write('${typeParameter.name} extends ${boundElement.name!}');
}
Expand Down