Skip to content

Commit

Permalink
Mark Attribute.name as visibleForOverriding (#3726)
Browse files Browse the repository at this point in the history
  • Loading branch information
srawlins authored Mar 18, 2024
1 parent 67f72d5 commit 057d0ed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 23 deletions.
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

0 comments on commit 057d0ed

Please sign in to comment.