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

Unified Diff: sdk/lib/_internal/dartdoc/lib/dartdoc.dart

Issue 18323004: Add lookupInScope to DeclarationMirror. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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
Index: sdk/lib/_internal/dartdoc/lib/dartdoc.dart
diff --git a/sdk/lib/_internal/dartdoc/lib/dartdoc.dart b/sdk/lib/_internal/dartdoc/lib/dartdoc.dart
index 02748759b184659a1ffdc0ffaff37190aeb9138c..e7d1eec34ac4db85f963ad05e6c758516baf03c8 100644
--- a/sdk/lib/_internal/dartdoc/lib/dartdoc.dart
+++ b/sdk/lib/_internal/dartdoc/lib/dartdoc.dart
@@ -975,7 +975,6 @@ class Dartdoc {
}
_totalLibraries++;
_currentLibrary = library;
- _currentType = null;
startFile(libraryUrl(library));
writeHeader('${displayName(library)} Library',
@@ -1032,6 +1031,8 @@ class Dartdoc {
docType(type);
}
+
+ _currentLibrary = null;
}
void docTypes(List types, String header) {
@@ -1102,6 +1103,8 @@ class Dartdoc {
writeTypeFooter();
writeFooter();
endFile();
+
+ _currentType = null;
}
/** Override this to write additional content at the end of a type's page. */
@@ -1575,6 +1578,8 @@ class Dartdoc {
writeln('</div>');
writeln('</div>');
+
+ _currentMember = null;
}
void docField(ContainerMirror host, VariableMirror field,
@@ -1660,6 +1665,8 @@ class Dartdoc {
writeln('</div>');
writeln('</div>');
+
+ _currentMember = null;
}
void docParamList(ContainerMirror enclosingType,
@@ -2012,6 +2019,28 @@ class Dartdoc {
return anchor;
}
+ DeclarationMirror declaration = currentMember;
+ if (declaration == null) {
Andrei Mouravski 2013/07/01 17:46:26 Nit: qOne line these?
Johnni Winther 2013/07/03 05:47:57 Done.
+ declaration = currentType;
+ }
+ if (declaration == null) {
+ declaration = currentLibrary;
+ }
+ DeclarationMirror lookupResult;
Andrei Mouravski 2013/07/01 17:46:26 Nit: Why not just reuse declaration?
Johnni Winther 2013/07/03 05:47:57 Done.
+ if (declaration != null) {
+ lookupResult = lookupQualifiedInScope(declaration, name);
+ }
+
+ if (lookupResult != null) {
+ if (lookupResult is TypeVariableMirror) {
+ return makeLink(typeUrl(lookupResult.owner));
+ } if (lookupResult is TypeMirror) {
+ return makeLink(typeUrl(lookupResult));
+ } else if (lookupResult is MethodMirror) {
+ return makeLink(memberUrl(lookupResult));
+ }
+ }
+
// See if it's a parameter of the current method.
if (currentMember is MethodMirror) {
for (final parameter in currentMember.parameters) {

Powered by Google App Engine
This is Rietveld 408576698