Index: pkg/docgen/lib/src/models/typedef.dart |
diff --git a/pkg/docgen/lib/src/models/typedef.dart b/pkg/docgen/lib/src/models/typedef.dart |
index 6d2890f2f7b106bf03f19b3642b6e217b581225b..4830d779fd0344be6cb1571c4f78ef9e44e18899 100644 |
--- a/pkg/docgen/lib/src/models/typedef.dart |
+++ b/pkg/docgen/lib/src/models/typedef.dart |
@@ -17,7 +17,7 @@ import 'generic.dart'; |
import 'parameter.dart'; |
import 'owned_indexable.dart'; |
-class Typedef extends OwnedIndexable { |
+class Typedef extends OwnedIndexable<TypedefMirror> { |
final String returnType; |
final Map<String, Parameter> parameters; |
@@ -61,7 +61,32 @@ class Typedef extends OwnedIndexable { |
return map; |
} |
- markdown.Node fixReference(String name) => owner.fixReference(name); |
+ /// Look for the specified name starting with the current member, and |
kevmoo
2014/04/20 21:34:54
Copied from Method. Works perfectly.
|
+ /// progressively working outward to the current library scope. |
+ String findElementInScope(String name) { |
+ var lookupFunc = determineLookupFunc(name); |
+ |
+ var memberScope = lookupFunc(this.mirror, name); |
+ if (memberScope != null) { |
+ // do we check for a dummy mirror returned here and look up with an owner |
+ // higher ooooor in getDocgenObject do we include more things in our |
+ // lookup |
+ var result = getDocgenObject(memberScope, owner); |
+ if (result is DummyMirror && owner.owner != null |
+ && owner.owner is! DummyMirror) { |
+ var aresult = getDocgenObject(memberScope, owner.owner); |
+ if (aresult is! DummyMirror) result = aresult; |
+ } |
+ if (result is DummyMirror) return packagePrefix + result.docName; |
+ return result.packagePrefix + result.docName; |
+ } |
+ |
+ if (owner != null) { |
+ var result = owner.findElementInScope(name); |
+ if (result != null) return result; |
+ } |
+ return super.findElementInScope(name); |
+ } |
String get typeName => 'typedef'; |