Skip to content

Tidy some comments #3741

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 3, 2024
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
21 changes: 11 additions & 10 deletions lib/src/model/documentation_comment.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,6 @@ mixin DocumentationComment

List<DocumentationComment>? _documentationFrom;

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

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

/// Returns true if the raw documentation comment has a 'nodoc' indication.
/// Whether the raw documentation comment is considered to be 'nodoc', an
/// attribute indicating that any documentation should not be included in
/// dartdoc's generated output.
///
/// An element is considered to be 'nodoc' if any of the following are true:
/// * a global 'nodoc' configuration has been set for this element (this
/// feature is deprecated),
/// * the element has no documentation comment,
/// * the documentation comment contains the `@nodoc` dartdoc directive.
late final bool hasNodoc = () {
if (packageGraph.configSetsNodocFor(element.source!.fullName)) {
return true;
Expand Down
7 changes: 6 additions & 1 deletion lib/src/model/inheritable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,12 @@ mixin Inheritable on ContainerMember {

Inheritable? get overriddenElement;

/// True if this [Inheritable] is overriding a superclass.
/// Whether this [Inheritable] is overriding a member from a superclass.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also mention the relationship between isOverride and isInherited like you mentioned before in GVC? Might be good information for later.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

///
/// This is distinct from [isInherited]. An inheritable member which is an
/// override is explicitly written in its container. An inheritable member
/// which is implicitly included in a container is "inherited", and not an
/// override.
late final bool isOverride = () {
// The canonical version of the enclosing element -- not
// [canonicalEnclosingElement], as that is the element enclosing the
Expand Down
8 changes: 8 additions & 0 deletions lib/src/model/locatable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@
// BSD-style license that can be found in the LICENSE file.

import 'package:analyzer/dart/element/element.dart' show Element;
import 'package:dartdoc/src/model/model.dart';

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

/// True if documentationFrom contains only one item, [this].
Expand Down
8 changes: 6 additions & 2 deletions lib/src/model/package_graph.dart
Original file line number Diff line number Diff line change
Expand Up @@ -903,8 +903,12 @@ class PackageGraph with CommentReferable, Nameable {
/// Glob lookups can be expensive. Cache per filename.
final _configSetsNodocFor = HashMap<String, bool>();

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