1
- // Copyright (c) 2019 , the Dart project authors. Please see the AUTHORS file
1
+ // Copyright (c) 2021 , the Dart project authors. Please see the AUTHORS file
2
2
// for details. All rights reserved. Use of this source code is governed by a
3
3
// BSD-style license that can be found in the LICENSE file.
4
4
@@ -13,17 +13,19 @@ import 'package:dartdoc/src/model_utils.dart' as model_utils;
13
13
import 'package:dartdoc/src/quiver.dart' as quiver;
14
14
import 'package:meta/meta.dart' ;
15
15
16
- /// An mixin to build an [InheritingContainer] capable of being constructed
16
+ /// A mixin to build an [InheritingContainer] capable of being constructed
17
17
/// with a direct call to a [Constructor] in Dart.
18
18
///
19
19
/// Note that [Constructor] s are not considered to be modifiers so a
20
20
/// [hasModifier] override is not necessary for this mixin.
21
21
mixin Constructable on InheritingContainer {
22
- Iterable <Constructor > get constructors => element.constructors
22
+ List <Constructor > _constructors;
23
+ Iterable <Constructor > get constructors => _constructors ?? = element
24
+ .constructors
23
25
.map ((e) => ModelElement .from (e, library, packageGraph) as Constructor );
24
26
25
27
@override
26
- bool get hasPublicConstructors => publicConstructors .isNotEmpty;
28
+ bool get hasPublicConstructors => publicConstructorsSorted .isNotEmpty;
27
29
28
30
@visibleForTesting
29
31
Iterable <Constructor > get publicConstructors =>
@@ -222,18 +224,11 @@ abstract class InheritingContainer extends Container
222
224
/// [ClassElement] is analogous to [InheritingContainer] .
223
225
ClassElement get element => super .element;
224
226
225
- // TODO(srawlins): To make final, remove public getter, setter, rename to be
226
- // public, and add `final` modifier.
227
- DefinedElementType _supertype;
228
- DefinedElementType get supertype => _supertype;
229
-
230
- @Deprecated ('Field intended to be final; setter will be removed as early as '
231
- 'Dartdoc 1.0.0' )
232
- set supertype (DefinedElementType value) => _supertype = value;
227
+ final DefinedElementType supertype;
233
228
234
229
InheritingContainer (
235
230
ClassElement element, Library library, PackageGraph packageGraph)
236
- : _supertype = element.supertype? .element? .supertype == null
231
+ : supertype = element.supertype? .element? .supertype == null
237
232
? null
238
233
: ElementType .from (element.supertype, library, packageGraph),
239
234
super (element, library, packageGraph);
@@ -592,7 +587,6 @@ abstract class InheritingContainer extends Container
592
587
593
588
List <TypeParameter > _typeParameters;
594
589
595
- // a stronger hash?
596
590
@override
597
591
List <TypeParameter > get typeParameters {
598
592
_typeParameters ?? = element.typeParameters.map ((f) {
0 commit comments