Skip to content

Commit 67ff903

Browse files
committed
Fix the problems part3 made worse.
1 parent 82c668a commit 67ff903

File tree

277 files changed

+1573
-4112
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

277 files changed

+1573
-4112
lines changed

lib/src/element_type.dart

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ class ElementType {
2929

3030
bool get isParameterType => (_type is TypeParameterType);
3131

32+
/// This type is a public type if the underlying, canonical element is public.
33+
/// This avoids discarding the resolved type information as canonicalization
34+
/// would ordinarily do.
35+
bool get isPublic {
36+
Class canonicalClass = element.package.findCanonicalModelElementFor(element.element) ?? element;
37+
return canonicalClass.isPublic;
38+
}
39+
3240
String get linkedName {
3341
if (_linkedName == null) {
3442
StringBuffer buf = new StringBuffer();
@@ -61,8 +69,7 @@ class ElementType {
6169
}
6270

6371
String get name {
64-
if (_type.name == null)
65-
return _type.element.name;
72+
if (_type.name == null) return _type.element.name;
6673
return _type.name;
6774
}
6875

lib/src/html/html_generator_instance.dart

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ class HtmlGeneratorInstance implements HtmlOptions {
102102
for (var clazz in lib.allClasses.where((c) => c.isDocumented)) {
103103
generateClass(package, lib, clazz);
104104

105-
for (var constructor in clazz.constructors.where((c) => c.isDocumented)) {
105+
for (var constructor
106+
in clazz.constructors.where((c) => c.isDocumented)) {
106107
if (!constructor.isCanonical) continue;
107108
generateConstructor(package, lib, clazz, constructor);
108109
}
@@ -112,12 +113,14 @@ class HtmlGeneratorInstance implements HtmlOptions {
112113
generateConstant(package, lib, clazz, constant);
113114
}
114115

115-
for (var property in clazz.staticProperties.where((s) => s.isDocumented)) {
116+
for (var property
117+
in clazz.staticProperties.where((s) => s.isDocumented)) {
116118
if (!property.isCanonical) continue;
117119
generateProperty(package, lib, clazz, property);
118120
}
119121

120-
for (var property in clazz.propertiesForPages.where((p) => p.isDocumented)) {
122+
for (var property
123+
in clazz.propertiesForPages.where((p) => p.isDocumented)) {
121124
if (!property.isCanonical) continue;
122125
generateProperty(package, lib, clazz, property);
123126
}
@@ -127,7 +130,8 @@ class HtmlGeneratorInstance implements HtmlOptions {
127130
generateMethod(package, lib, clazz, method);
128131
}
129132

130-
for (var operator in clazz.operatorsForPages.where((o) => o.isDocumented)) {
133+
for (var operator
134+
in clazz.operatorsForPages.where((o) => o.isDocumented)) {
131135
if (!operator.isCanonical) continue;
132136
generateMethod(package, lib, clazz, operator);
133137
}
@@ -140,10 +144,12 @@ class HtmlGeneratorInstance implements HtmlOptions {
140144

141145
for (var eNum in lib.enums.where((e) => e.isDocumented)) {
142146
generateEnum(package, lib, eNum);
143-
for (var property in eNum.propertiesForPages.where((p) => p.isDocumented)) {
147+
for (var property
148+
in eNum.propertiesForPages.where((p) => p.isDocumented)) {
144149
generateProperty(package, lib, eNum, property);
145150
}
146-
for (var operator in eNum.operatorsForPages.where((o) => o.isDocumented)) {
151+
for (var operator
152+
in eNum.operatorsForPages.where((o) => o.isDocumented)) {
147153
generateMethod(package, lib, eNum, operator);
148154
}
149155
for (var method in eNum.methodsForPages.where((m) => m.isDocumented)) {
@@ -156,10 +162,6 @@ class HtmlGeneratorInstance implements HtmlOptions {
156162
}
157163

158164
for (var property in lib.properties.where((p) => p.isDocumented)) {
159-
if (property.name == 'topLevelVariable')
160-
1+1;
161-
if (property.linkedReturnType == '')
162-
1+1;
163165
generateTopLevelProperty(package, lib, property);
164166
}
165167

lib/src/html/template_data.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ class LibraryTemplateData extends TemplateData<Library> {
143143
yield new Subnav('Properties', '${library.href}#properties');
144144
if (library.hasPublicFunctions)
145145
yield new Subnav('Functions', '${library.href}#functions');
146-
if (library.hasPublicEnums) yield new Subnav('Enums', '${library.href}#enums');
146+
if (library.hasPublicEnums)
147+
yield new Subnav('Enums', '${library.href}#enums');
147148
if (library.hasPublicTypedefs)
148149
yield new Subnav('Typedefs', '${library.href}#typedefs');
149150
if (library.hasPublicExceptions)

lib/src/markdown_processor.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,6 @@ Element _findRefElementInLibrary(String codeRef, ModelElement element,
390390
assert(element != null);
391391
assert(element.package.allLibrariesAdded);
392392

393-
394393
String codeRefChomped = codeRef.replaceFirst(isConstructor, '');
395394

396395
final Library library = element.library;
@@ -453,7 +452,7 @@ Element _findRefElementInLibrary(String codeRef, ModelElement element,
453452

454453
if (results.isEmpty && realClass != null) {
455454
for (Class superClass
456-
in realClass.superChain.map((et) => et.element as Class)) {
455+
in realClass.publicSuperChain.map((et) => et.element as Class)) {
457456
if (!tryClasses.contains(superClass)) {
458457
_getResultsForClass(
459458
superClass, codeRefChomped, results, codeRef, package);
@@ -630,7 +629,7 @@ void _getResultsForClass(Class tryClass, String codeRefChomped,
630629
// TODO(jcollins-g): This makes our caller ~O(n^2) vs length of superChain.
631630
// Fortunately superChains are short, but optimize this if it matters.
632631
superChain
633-
.addAll(tryClass.superChainRaw.map((t) => t.returnElement as Class));
632+
.addAll(tryClass.superChain.map((t) => t.returnElement as Class));
634633
List<String> codeRefParts = codeRefChomped.split('.');
635634
for (final c in superChain) {
636635
// TODO(jcollins-g): add a hash-map-enabled lookup function to Class?

0 commit comments

Comments
 (0)