Skip to content

Mark Attribute.name as visibleForOverriding #3726

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 1 commit into from
Mar 18, 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: 0 additions & 21 deletions lib/src/generator/templates.runtime_renderers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -601,27 +601,6 @@ class _Renderer_Attribute extends RendererBase<Attribute> {
parent: r);
},
),
'name': Property(
getValue: (CT_ c) => c.name,
renderVariable:
(CT_ c, Property<CT_> self, List<String> remainingNames) {
if (remainingNames.isEmpty) {
return self.getValue(c).toString();
}
var name = remainingNames.first;
var nextProperty =
_Renderer_String.propertyMap().getValue(name);
return nextProperty.renderVariable(
self.getValue(c) as String,
nextProperty,
[...remainingNames.skip(1)]);
},
isNullValue: (CT_ c) => false,
renderValue: (CT_ c, RendererBase<CT_> r,
List<MustachioNode> ast, StringSink sink) {
_render_String(c.name, ast, r.template, sink, parent: r);
},
),
'sortGroup': Property(
getValue: (CT_ c) => c.sortGroup,
renderVariable: (CT_ c, Property<CT_> self,
Expand Down
9 changes: 7 additions & 2 deletions lib/src/model/attribute.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,21 @@

import 'package:collection/collection.dart';
import 'package:dartdoc/src/model/privacy.dart';
import 'package:meta/meta.dart';

int byAttributeOrdering(Attribute a, Attribute b) {
if (a.sortGroup < b.sortGroup) return -1;
if (a.sortGroup > b.sortGroup) return 1;
return compareAsciiLowerCaseNatural(a.name, b.name);
}

/// An attribute includes both explicit annotations in code (e.g. `deprecated`)
/// as well as others added by the documentation system (`read-write`).
/// An attribute on an element.
///
/// 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 {
// A name, only used for sorting.
@visibleForOverriding
final String name;

/// Numerical sort group for this attribute.
Expand Down