diff --git a/lib/src/element_type.dart b/lib/src/element_type.dart index cd9fcb3778..0cf0284145 100644 --- a/lib/src/element_type.dart +++ b/lib/src/element_type.dart @@ -20,7 +20,7 @@ import 'package:meta/meta.dart'; /// Base class representing a type in Dartdoc. It wraps a [DartType], and /// may link to a [ModelElement]. -abstract class ElementType with CommentReferable, Nameable implements Privacy { +abstract class ElementType with CommentReferable, Nameable { final DartType type; @override final PackageGraph packageGraph; diff --git a/lib/src/generator/templates.runtime_renderers.dart b/lib/src/generator/templates.runtime_renderers.dart index 9b87726414..cec79065b8 100644 --- a/lib/src/generator/templates.runtime_renderers.dart +++ b/lib/src/generator/templates.runtime_renderers.dart @@ -16301,7 +16301,6 @@ const _invisibleGetters = { 'allHrefs', 'allImplementersAdded', 'allInheritableElements', - 'allLibraries', 'allLibrariesAdded', 'analysisContext', 'breadcrumbName', diff --git a/lib/src/model/annotation.dart b/lib/src/model/annotation.dart index 672ba8d338..d239fc2f7a 100644 --- a/lib/src/model/annotation.dart +++ b/lib/src/model/annotation.dart @@ -55,7 +55,6 @@ final class Annotation extends Attribute { 'non-callable element used as annotation?: ${_annotation.element}') }; - @override bool get isPublic { final modelType = _modelType; if (!modelType.isPublic) { diff --git a/lib/src/model/attribute.dart b/lib/src/model/attribute.dart index 355f989b89..afc7488a0f 100644 --- a/lib/src/model/attribute.dart +++ b/lib/src/model/attribute.dart @@ -3,7 +3,6 @@ // BSD-style license that can be found in the LICENSE file. import 'package:collection/collection.dart'; -import 'package:dartdoc/src/model/privacy.dart'; import 'package:meta/meta.dart'; int byAttributeOrdering(Attribute a, Attribute b) { @@ -16,7 +15,7 @@ int byAttributeOrdering(Attribute a, Attribute b) { /// /// These include both explicit annotations in code (e.g. `deprecated`) as well /// as others added by the documentation system (e.g. 'no setter'). -abstract class Attribute implements Privacy { +abstract class Attribute { // A name, only used for sorting. @visibleForOverriding final String name; @@ -57,9 +56,6 @@ abstract class Attribute implements Privacy { final class _BuiltInAttribute extends Attribute { const _BuiltInAttribute(super.name, super.sortGroup); - @override - bool get isPublic => false; - @override String get linkedName => name; diff --git a/lib/src/model/documentation.dart b/lib/src/model/documentation.dart index c11045f8e4..89adebfd8e 100644 --- a/lib/src/model/documentation.dart +++ b/lib/src/model/documentation.dart @@ -37,7 +37,12 @@ class Documentation { // situation where one public getter might set both fields, but might only // set one. We have this awkward check to make sure we set both fields if // we'll need both fields. - assert(_element.isCanonical); + assert( + _element.isCanonical, + "generating docs for non-canonical element: '$_element' " + "('${_element.runtimeType}', ${_element.hashCode}), representing " + "'${_element.element}'", + ); return _asHtml; } diff --git a/lib/src/model/model.dart b/lib/src/model/model.dart index 07a8f83b94..966253a0f2 100644 --- a/lib/src/model/model.dart +++ b/lib/src/model/model.dart @@ -39,7 +39,6 @@ export 'package.dart'; export 'package_builder.dart'; export 'package_graph.dart'; export 'parameter.dart'; -export 'privacy.dart'; export 'source_code_mixin.dart'; export 'top_level_container.dart'; export 'top_level_variable.dart'; diff --git a/lib/src/model/model_element.dart b/lib/src/model/model_element.dart index 20b37f7894..6a15eccbc6 100644 --- a/lib/src/model/model_element.dart +++ b/lib/src/model/model_element.dart @@ -69,7 +69,7 @@ abstract class ModelElement Indexable, FeatureSet, DocumentationComment - implements Comparable, Documentable, Privacy { + implements Comparable, Documentable { // TODO(jcollins-g): This really wants a "member that has a type" class. final Member? _originalMember; final Library _library; diff --git a/lib/src/model/nameable.dart b/lib/src/model/nameable.dart index 24b7c4c1da..1f8d852f1b 100644 --- a/lib/src/model/nameable.dart +++ b/lib/src/model/nameable.dart @@ -11,10 +11,9 @@ import 'package:dartdoc/src/model/container.dart'; import 'package:dartdoc/src/model/library.dart'; import 'package:dartdoc/src/model/model_element.dart'; import 'package:dartdoc/src/model/package_graph.dart'; -import 'package:dartdoc/src/model/privacy.dart'; /// Something that has a name. -mixin Nameable implements Privacy { +mixin Nameable { String get name; /// A qualified name, mostly for use in the web search functionality, and for @@ -27,7 +26,16 @@ mixin Nameable implements Privacy { /// The name to use in breadcrumbs in the rendered documentation. String get breadcrumbName => name; - @override + /// Whether this is "package-public." + /// + /// A "package-public" element satisfies the following requirements: + /// * is not documented with the `@nodoc` directive, + /// * for a library, is found in a package's top-level 'lib' directory, and + /// not found in it's 'lib/src' directory, + /// * for a library member, is in a _public_ library's exported namespace, and + /// is not privately named, nor an unnamed extension, + /// * for a container (class, enum, extension, extension type, mixin) member, + /// is in a _public_ container, and is not privately named. bool get isPublic => name.isNotEmpty && !name.startsWith('_'); @override diff --git a/lib/src/model/package.dart b/lib/src/model/package.dart index fa39338da3..b7074e5ad6 100644 --- a/lib/src/model/package.dart +++ b/lib/src/model/package.dart @@ -29,8 +29,7 @@ const String htmlBasePlaceholder = r'%%__HTMLBASE_dartdoc_internal__%%'; /// A [LibraryContainer] that contains [Library] objects related to a particular /// package. class Package extends LibraryContainer - with Nameable, Locatable, Warnable, CommentReferable - implements Privacy { + with Nameable, Locatable, Warnable, CommentReferable { @override final String name; diff --git a/lib/src/model/privacy.dart b/lib/src/model/privacy.dart deleted file mode 100644 index ca5ae680a7..0000000000 --- a/lib/src/model/privacy.dart +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -/// Classes implementing this have a package-public/private distinction. -abstract interface class Privacy { - /// Whether this is "package-public." - /// - /// A "package-public" element satisfies the following requirements: - /// * is not documented with the `@nodoc` directive, - /// * for a library, is found in a package's top-level 'lib' directory, and - /// not found in it's 'lib/src' directory, - /// * for a library member, is in a _public_ library's exported namespace, and - /// is not privately named, nor an unnamed extension, - /// * for a container (class, enum, extension, extension type, mixin) member, - /// is in a _public_ container, and is not privately named. - bool get isPublic; -} diff --git a/lib/src/model_utils.dart b/lib/src/model_utils.dart index 23f6ffd98b..10a617884b 100644 --- a/lib/src/model_utils.dart +++ b/lib/src/model_utils.dart @@ -95,6 +95,6 @@ extension IterableOfDocumentableExtension Iterable get whereDocumented => where((e) => e.isDocumented).wherePublic; } -extension IterableOfNameableExtension on Iterable { +extension IterableOfNameableExtension on Iterable { Iterable get wherePublic => where((e) => e.isPublic); }