Skip to content

Commit 12988e0

Browse files
authored
Tidy some comments (#3741)
Tidy some comments: * Move the `Locatable.documentationFrom` comment from an override to the highest declaration. * Make a few comments more idiomatic.
1 parent 2559a77 commit 12988e0

File tree

4 files changed

+31
-13
lines changed

4 files changed

+31
-13
lines changed

lib/src/model/documentation_comment.dart

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,6 @@ mixin DocumentationComment
3838

3939
List<DocumentationComment>? _documentationFrom;
4040

41-
/// The [ModelElement](s) from which we will get documentation.
42-
///
43-
/// Can be more than one if this is a [Field] composing documentation from
44-
/// multiple [Accessor]s.
45-
///
46-
/// This will walk up the inheritance hierarchy to find docs, if the current
47-
/// class doesn't have docs for this element.
4841
@override
4942
List<DocumentationComment> get documentationFrom =>
5043
_documentationFrom ??= () {
@@ -72,11 +65,19 @@ mixin DocumentationComment
7265
/// like `///`, `//`, `/*`, `*/`.
7366
String get documentationComment => element.documentationComment ?? '';
7467

75-
/// True if [this] has a synthetic/inherited or local documentation
76-
/// comment. False otherwise.
68+
/// Whether `this` has a synthetic/inherited or local documentation comment,
69+
/// and false otherwise.
7770
bool get hasDocumentationComment => element.documentationComment != null;
7871

79-
/// Returns true if the raw documentation comment has a 'nodoc' indication.
72+
/// Whether the raw documentation comment is considered to be 'nodoc', an
73+
/// attribute indicating that any documentation should not be included in
74+
/// dartdoc's generated output.
75+
///
76+
/// An element is considered to be 'nodoc' if any of the following are true:
77+
/// * a global 'nodoc' configuration has been set for this element (this
78+
/// feature is deprecated),
79+
/// * the element has no documentation comment,
80+
/// * the documentation comment contains the `@nodoc` dartdoc directive.
8081
late final bool hasNodoc = () {
8182
if (packageGraph.configSetsNodocFor(element.source!.fullName)) {
8283
return true;

lib/src/model/inheritable.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,12 @@ mixin Inheritable on ContainerMember {
125125

126126
Inheritable? get overriddenElement;
127127

128-
/// True if this [Inheritable] is overriding a superclass.
128+
/// Whether this [Inheritable] is overriding a member from a superclass.
129+
///
130+
/// This is distinct from [isInherited]. An inheritable member which is an
131+
/// override is explicitly written in its container. An inheritable member
132+
/// which is implicitly included in a container is "inherited", and not an
133+
/// override.
129134
late final bool isOverride = () {
130135
// The canonical version of the enclosing element -- not
131136
// [canonicalEnclosingElement], as that is the element enclosing the

lib/src/model/locatable.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,17 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
import 'package:analyzer/dart/element/element.dart' show Element;
6+
import 'package:dartdoc/src/model/model.dart';
67

78
/// Something that can be located for warning purposes.
89
mixin Locatable {
10+
/// The [Locatable](s) from which we will get documentation.
11+
///
12+
/// Can be more than one if this is a [Field] composing documentation from
13+
/// multiple [Accessor]s.
14+
///
15+
/// This will walk up the inheritance hierarchy to find docs, if the current
16+
/// class doesn't have docs for this element.
917
List<Locatable> get documentationFrom;
1018

1119
/// True if documentationFrom contains only one item, [this].

lib/src/model/package_graph.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -903,8 +903,12 @@ class PackageGraph with CommentReferable, Nameable {
903903
/// Glob lookups can be expensive. Cache per filename.
904904
final _configSetsNodocFor = HashMap<String, bool>();
905905

906-
/// Given an element's location, look up the nodoc configuration data and
907-
/// determine whether to unconditionally treat the element as "nodoc".
906+
/// Given an element's [fullName], look up the nodoc configuration data and
907+
/// determine whether to unconditionally treat the element as "nodoc", an
908+
/// attribute indicating that documentation should not be included in
909+
/// dartdoc's generated output.
910+
///
911+
/// This configuration setting is deprecated.
908912
bool configSetsNodocFor(String fullName) {
909913
return _configSetsNodocFor.putIfAbsent(fullName, () {
910914
var file = resourceProvider.getFile(fullName);

0 commit comments

Comments
 (0)