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

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

Issue 18242010: used lookupInScope(name) to find the qualified names in comments. (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 | pkg/docgen/test/single_library_test.dart » ('j') | 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 76cb0bb6299763dfc982b338b18e3a770246973f..3431fe89b42be489e7d0f33fb5380baed8786905 100644
--- a/pkg/docgen/lib/docgen.dart
+++ b/pkg/docgen/lib/docgen.dart
@@ -55,12 +55,12 @@ markdown.Resolver linkResolver;
* Also initializes the command line arguments.
*
* [packageRoot] is the packages directory of the directory being analyzed.
- * If [includeSdk] is 'true', then any SDK libraries explicitly imported will
+ * If [includeSdk] is `true`, then any SDK libraries explicitly imported will
* also be documented.
- * If [parseSdk] is 'true', then all Dart SDK libraries will be documented.
+ * If [parseSdk] is `true`, then all Dart SDK libraries will be documented.
* This option is useful when only the SDK libraries are needed.
*
- * Returns true if docgen sucessfuly completes.
+ * Returns `true` if docgen sucessfuly completes.
*/
Future<bool> docgen(List<String> files, {String packageRoot,
bool outputToYaml: true, bool includePrivate: false, bool includeSdk: false,
@@ -272,13 +272,20 @@ String _getComment(DeclarationMirror mirror) {
}
/**
- * Converts all [_] references in comments to <code>_</code>.
+ * Converts all [foo] references in comments to <a>libraryName.foo</a>.
*/
-// TODO(tmandel): Create proper links for [_] style markdown based
-// on scope once layout of viewer is finished.
markdown.Node fixReference(String name, LibraryMirror currentLibrary,
ClassMirror currentClass, MemberMirror currentMember) {
- return new markdown.Element.text('code', name);
+ var reference;
+ var memberScope = currentMember == null ?
+ null : currentMember.lookupInScope(name);
+ if (memberScope != null) reference = memberScope.qualifiedName;
+ else {
+ var classScope = currentClass == null ?
+ null : currentClass.lookupInScope(name);
+ reference = classScope != null ? classScope.qualifiedName : name;
+ }
+ return new markdown.Element.text('a', reference);
}
/**
« no previous file with comments | « no previous file | pkg/docgen/test/single_library_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698