Skip to content

Commit 392310d

Browse files
committed
review comments
1 parent 82c02e5 commit 392310d

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

lib/src/model/inheriting_container.dart

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

@@ -13,17 +13,19 @@ import 'package:dartdoc/src/model_utils.dart' as model_utils;
1313
import 'package:dartdoc/src/quiver.dart' as quiver;
1414
import 'package:meta/meta.dart';
1515

16-
/// An mixin to build an [InheritingContainer] capable of being constructed
16+
/// A mixin to build an [InheritingContainer] capable of being constructed
1717
/// with a direct call to a [Constructor] in Dart.
1818
///
1919
/// Note that [Constructor]s are not considered to be modifiers so a
2020
/// [hasModifier] override is not necessary for this mixin.
2121
mixin Constructable on InheritingContainer {
22-
Iterable<Constructor> get constructors => element.constructors
22+
List<Constructor> _constructors;
23+
Iterable<Constructor> get constructors => _constructors ??= element
24+
.constructors
2325
.map((e) => ModelElement.from(e, library, packageGraph) as Constructor);
2426

2527
@override
26-
bool get hasPublicConstructors => publicConstructors.isNotEmpty;
28+
bool get hasPublicConstructors => publicConstructorsSorted.isNotEmpty;
2729

2830
@visibleForTesting
2931
Iterable<Constructor> get publicConstructors =>
@@ -222,18 +224,11 @@ abstract class InheritingContainer extends Container
222224
/// [ClassElement] is analogous to [InheritingContainer].
223225
ClassElement get element => super.element;
224226

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;
233228

234229
InheritingContainer(
235230
ClassElement element, Library library, PackageGraph packageGraph)
236-
: _supertype = element.supertype?.element?.supertype == null
231+
: supertype = element.supertype?.element?.supertype == null
237232
? null
238233
: ElementType.from(element.supertype, library, packageGraph),
239234
super(element, library, packageGraph);
@@ -592,7 +587,6 @@ abstract class InheritingContainer extends Container
592587

593588
List<TypeParameter> _typeParameters;
594589

595-
// a stronger hash?
596590
@override
597591
List<TypeParameter> get typeParameters {
598592
_typeParameters ??= element.typeParameters.map((f) {

0 commit comments

Comments
 (0)