Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Unified Diff: pkg/docgen/lib/docgen.dart

Issue 20617005: Returning the closest public superclass rather than returning "" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/docgen/lib/docgen.dart
diff --git a/pkg/docgen/lib/docgen.dart b/pkg/docgen/lib/docgen.dart
index 72588c80027d366b598c35327a2fff0f97300f6c..d80d64baf368c09758f117a5ea24e79b086c352f 100644
--- a/pkg/docgen/lib/docgen.dart
+++ b/pkg/docgen/lib/docgen.dart
@@ -620,13 +620,24 @@ class Class extends Indexable {
}
}
+ /**
+ * If a class extends a private superclass, find the closest public superclass
+ * of the private superclass.
+ */
+ String validSuperclass() {
+ if (superclass == null) return "";
Bob Nystrom 2013/08/01 23:31:40 Is there a reason to return "" instead of "Object"
janicejl 2013/08/02 00:49:09 Done.
+ else {
Bob Nystrom 2013/08/01 23:31:40 "else" isn't needed here.
janicejl 2013/08/02 00:49:09 Done.
+ if (_filterPrivate(superclass)) return superclass.qualifiedName;
Bob Nystrom 2013/08/01 23:31:40 "filter" is a bit confusing here. I would expect i
janicejl 2013/08/02 00:49:09 Done.
+ else return superclass.validSuperclass();
Bob Nystrom 2013/08/01 23:31:40 "else" isn't needed here.
janicejl 2013/08/02 00:49:09 Done.
+ }
+ }
+
/// Generates a map describing the [Class] object.
Map toMap() => {
'name': name,
'qualifiedname': qualifiedName,
'comment': comment,
- 'superclass': superclass == null ? "" : (_filterPrivate(superclass)) ?
- superclass.qualifiedName : "",
+ 'superclass': validSuperclass(),
'implements': new List.from(interfaces.where((e) => _filterPrivate(e))
.map((e) => e.qualifiedName)),
'subclass': new List.from(subclasses),
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698