Skip to content

Adjust interfaces for mustache. #2373

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
Oct 6, 2020
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
1 change: 1 addition & 0 deletions lib/src/model/categorization.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ abstract class Categorization implements ModelElement {
return _categories;
}

@override
Iterable<Category> get displayedCategories {
if (config.showUndocumentedCategories) return categories;
return categories.where((c) => c.isDocumented);
Expand Down
2 changes: 0 additions & 2 deletions lib/src/model/category.dart
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,6 @@ class Category extends Nameable

String get categoryLabel => _categoryRenderer.renderCategoryLabel(this);

@Deprecated(
'Public field is unused; will be removed as early as Dartdoc 1.0.0')
String get linkedName => _categoryRenderer.renderLinkedName(this);

int _categoryIndex;
Expand Down
7 changes: 5 additions & 2 deletions lib/src/model/class.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class Class extends Container
Iterable<Method> get instanceMethods =>
quiver.concat([super.instanceMethods, inheritedMethods]);

// Whether all instance methods are inherited, used in mustache templates.
@override
bool get publicInheritedInstanceMethods =>
instanceMethods.every((f) => f.isInherited);

Expand Down Expand Up @@ -131,11 +131,12 @@ class Class extends Container
return kind;
}

// Whether any constructors are public, used in mustache templates.
@override
bool get hasPublicConstructors => publicConstructorsSorted.isNotEmpty;

List<Constructor> _publicConstructorsSorted;

@override
List<Constructor> get publicConstructorsSorted =>
_publicConstructorsSorted ??= publicConstructors.toList()..sort(byName);

Expand Down Expand Up @@ -247,6 +248,7 @@ class Class extends Container
return _inheritedOperators;
}

@override
Iterable<Operator> get publicInheritedInstanceOperators =>
model_utils.filterNonPublic(inheritedOperators);

Expand Down Expand Up @@ -524,6 +526,7 @@ class Class extends Container
Iterable<Field> get instanceFields =>
_instanceFields ??= allFields.where((f) => !f.isStatic);

@override
bool get publicInheritedInstanceFields =>
publicInstanceFields.every((f) => f.isInherited);

Expand Down
19 changes: 19 additions & 0 deletions lib/src/model/container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,25 @@ abstract class Container extends ModelElement with TypeParameters {
.where((m) => !m.isStatic && !m.isOperator)
.toList(growable: false);

/// Whether any constructors are public.
///
/// This is only used in mustache templates.
bool get hasPublicConstructors => false;

Iterable<Constructor> get publicConstructorsSorted => [];

/// Whether all instance fields are inherited.
///
/// This is only used in mustache templates.
bool get publicInheritedInstanceFields => false;

/// Whether all instance methods are inherited.
///
/// This is only used in mustache templates.
bool get publicInheritedInstanceMethods => false;

Iterable<Operator> get publicInheritedInstanceOperators => [];

@nonVirtual
bool get hasPublicInstanceMethods =>
model_utils.filterNonPublic(instanceMethods).isNotEmpty;
Expand Down
7 changes: 5 additions & 2 deletions lib/src/model/model_element.dart
Original file line number Diff line number Diff line change
Expand Up @@ -382,10 +382,13 @@ abstract class ModelElement extends Canonicalization
throw 'Unknown type ${e.runtimeType}';
}

/// Stub for mustache4dart, or it will search enclosing elements to find
/// names for members.
// Stub for mustache, which would otherwise search enclosing elements to find
// names for members.
bool get hasCategoryNames => false;

// Stub for mustache.
Iterable<Category> get displayedCategories => [];

Set<Library> get exportedInLibraries {
return library.packageGraph.libraryElementReexportedBy[element.library];
}
Expand Down