diff --git a/lib/src/generator/templates.runtime_renderers.dart b/lib/src/generator/templates.runtime_renderers.dart index 8e10f949da..6b606f4a78 100644 --- a/lib/src/generator/templates.runtime_renderers.dart +++ b/lib/src/generator/templates.runtime_renderers.dart @@ -1650,13 +1650,12 @@ class _Renderer_Class extends RendererBase { renderVariable: (CT_ c, Property self, List remainingNames) => self.renderSimpleVariable( - c, remainingNames, 'InterfaceElement'), + c, remainingNames, 'ClassElement'), isNullValue: (CT_ c) => false, renderValue: (CT_ c, RendererBase r, List ast, StringSink sink) { renderSimple(c.element, ast, r.template, sink, - parent: r, - getters: _invisibleGetters['InterfaceElement']!); + parent: r, getters: _invisibleGetters['ClassElement']!); }, ), 'fileName': Property( @@ -15960,6 +15959,27 @@ const _invisibleGetters = { 'lineNumber', 'runtimeType' }, + 'ClassElement': { + 'augmentation', + 'augmentationTarget', + 'augmented', + 'hasNonFinalField', + 'hashCode', + 'isAbstract', + 'isBase', + 'isConstructable', + 'isDartCoreEnum', + 'isDartCoreObject', + 'isExhaustive', + 'isFinal', + 'isInline', + 'isInterface', + 'isMixinApplication', + 'isMixinClass', + 'isSealed', + 'isValidMixin', + 'runtimeType' + }, 'CommentReferable': { 'definingCommentReferable', 'href', diff --git a/lib/src/model/class.dart b/lib/src/model/class.dart index ea3aeff579..abc9b75da9 100644 --- a/lib/src/model/class.dart +++ b/lib/src/model/class.dart @@ -5,7 +5,7 @@ import 'package:analyzer/dart/element/element.dart'; import 'package:dartdoc/src/model/model.dart'; -/// A [Container] defined with a `class` or `enum` declaration. +/// A [Container] defined with a `class` declaration. /// /// Members follow similar naming rules to [Container], with the following /// additions: @@ -14,7 +14,7 @@ import 'package:dartdoc/src/model/model.dart'; /// **inherited**: Filtered getters giving only inherited children. class Class extends InheritingContainer with Constructable, MixedInTypes { @override - final InterfaceElement element; + final ClassElement element; @override late final List allModelElements = [ @@ -50,16 +50,10 @@ class Class extends InheritingContainer with Constructable, MixedInTypes { String get fileName => '$name-class.html'; @override - bool get isAbstract => switch (element) { - ClassElement class_ when class_.isAbstract => true, - _ => false, - }; + bool get isAbstract => element.isAbstract; @override - bool get isBase => switch (element) { - ClassElement class_ when class_.isBase && !class_.isSealed => true, - _ => false, - }; + bool get isBase => element.isBase && !element.isSealed; bool get isErrorOrException { bool isError(InterfaceElement element) => @@ -72,28 +66,16 @@ class Class extends InheritingContainer with Constructable, MixedInTypes { } @override - bool get isFinal => switch (element) { - ClassElement class_ when class_.isFinal && !class_.isSealed => true, - _ => false, - }; + bool get isFinal => element.isFinal && !element.isSealed; @override - bool get isInterface => switch (element) { - ClassElement class_ when class_.isInterface && !class_.isSealed => true, - _ => false, - }; + bool get isInterface => element.isInterface && !element.isSealed; @override - bool get isMixinClass => switch (element) { - ClassElement class_ when class_.isMixinClass => true, - _ => false, - }; + bool get isMixinClass => element.isMixinClass; @override - bool get isSealed => switch (element) { - ClassElement class_ when class_.isSealed => true, - _ => false, - }; + bool get isSealed => element.isSealed; @override Kind get kind => Kind.class_;