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

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

Issue 60733011: Fixing some more resolving issues with super classes in docgen. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 15be68eb7676bd0378a61df7fc520a17083e1aa5..d86bf7131529f4df4f7ac38adb39b8788418a4b0 100644
--- a/pkg/docgen/lib/docgen.dart
+++ b/pkg/docgen/lib/docgen.dart
@@ -380,9 +380,10 @@ void _documentLibraries(List<LibraryMirror> libs, {bool includeSdk: false,
Library generateLibrary(dart2js.Dart2JsLibraryMirror library) {
_currentLibrary = library;
var result = new Library(docName(library), _commentToHtml(library),
- _variables(library.variables),
+ _classes(library.classes),
_methods(library.functions),
- _classes(library.classes), _isHidden(library));
+ _variables(library.variables),
+ _isHidden(library));
_findPackage(result, library);
logger.fine('Generated library for ${result.name}');
return result;
@@ -453,10 +454,23 @@ List<Annotation> _annotations(DeclarationMirror mirror) {
return annotations;
}
+/// Update the global pointers to the current mirror to the particular mirror
+/// we're documenting.
+void _updateCurrentMirror(DeclarationMirror mirror) {
+ if (mirror is LibraryMirror) {
+ _currentLibrary = mirror;
+ } else if (mirror is ClassMirror) {
+ _currentClass = mirror;
+ } else if (mirror is MethodMirror) {
+ _currentMember = mirror;
+ }
+}
+
/// Returns any documentation comments associated with a mirror with
/// simple markdown converted to html.
String _commentToHtml(DeclarationMirror mirror) {
String commentText;
+ _updateCurrentMirror(mirror);
mirror.metadata.forEach((metadata) {
if (metadata is CommentInstanceMirror) {
CommentInstanceMirror comment = metadata;
@@ -534,9 +548,12 @@ String findElementInScope(String name, LibraryMirror currentLibrary,
null : lookupFunc(currentMember, name);
if (memberScope != null) return docName(memberScope);
- var classScope = currentClass == null ?
- null : lookupFunc(currentClass, name);
- if (classScope != null) return docName(classScope);
+ var classScope = currentClass;
+ while (classScope != null) {
+ var classFunc = lookupFunc(currentClass, name);
+ if (classFunc != null) return docName(classFunc);
+ classScope = classScope.superclass;
+ }
var libraryScope = currentLibrary == null ?
null : lookupFunc(currentLibrary, name);
@@ -858,8 +875,8 @@ class Library extends Indexable {
return basic;
}
- Library(String name, String comment, this.variables,
- this.functions, this.classes, bool isPrivate) : super(name, comment,
+ Library(String name, String comment, this.classes, this.functions,
+ this.variables, bool isPrivate) : super(name, comment,
isPrivate, "");
/// Generates a map describing the [Library] object.
« 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