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

Unified Diff: utils/dartdoc/dartdoc.dart

Issue 9150011: Add some tests for dartdoc name reference resolution. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 11 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 | utils/dartdoc/files.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/dartdoc/dartdoc.dart
diff --git a/utils/dartdoc/dartdoc.dart b/utils/dartdoc/dartdoc.dart
index 01ba7a0b975f293d3b40aa4242f209c2de953a8f..ceeea47d5ec63136ba17fc2a891931cd7540c7c5 100644
--- a/utils/dartdoc/dartdoc.dart
+++ b/utils/dartdoc/dartdoc.dart
@@ -104,7 +104,9 @@ class Dartdoc {
md.InlineParser.syntaxes.insertRange(0, 1,
new md.CodeSyntax(@'\[\:((?:.|\n)*?)\:\]'));
- md.setImplicitLinkResolver(resolveNameReference);
+ md.setImplicitLinkResolver((name) => resolveNameReference(name,
+ currentLibrary: _currentLibrary, currentType: _currentType,
+ currentMember: _currentMember));
}
document(String entrypoint) {
@@ -780,7 +782,8 @@ class Dartdoc {
* brackets. It will try to figure out what the name refers to and link or
* style it appropriately.
*/
- md.Node resolveNameReference(String name) {
+ md.Node resolveNameReference(String name, [Member currentMember = null,
Bob Nystrom 2012/01/09 22:48:20 I wouldn't use "current", just "member", "type" an
+ Type currentType = null, Library currentLibrary = null]) {
makeLink(String href) {
final anchor = new md.Element.text('a', name);
anchor.attributes['href'] = relativePath(href);
@@ -803,8 +806,8 @@ class Dartdoc {
}
// See if it's a parameter of the current method.
- if (_currentMember != null) {
- for (final parameter in _currentMember.parameters) {
+ if (currentMember != null) {
+ for (final parameter in currentMember.parameters) {
if (parameter.name == name) {
final element = new md.Element.text('span', name);
element.attributes['class'] = 'param';
@@ -814,22 +817,22 @@ class Dartdoc {
}
// See if it's another member of the current type.
- if (_currentType != null) {
- final member = findMember(_currentType);
+ if (currentType != null) {
+ final member = findMember(currentType);
if (member != null) {
return makeLink(memberUrl(member));
}
}
// See if it's another type in the current library.
- if (_currentLibrary != null) {
- final type = _currentLibrary.types[name];
+ if (currentLibrary != null) {
+ final type = currentLibrary.types[name];
if (type != null) {
return makeLink(typeUrl(type));
}
// See if it's a top-level member in the current library.
- final member = findMember(_currentLibrary.topType);
+ final member = findMember(currentLibrary.topType);
if (member != null) {
return makeLink(memberUrl(member));
}
« no previous file with comments | « no previous file | utils/dartdoc/files.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698