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

Unified Diff: pkg/docgen/lib/src/models/typedef.dart

Issue 243483005: pkg/docgen: fixed type references within typedef doc comments (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: removed unused import Created 6 years, 8 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: 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..41a7b9025dc047748e818770a570dcab9280b911 100644
--- a/pkg/docgen/lib/src/models/typedef.dart
+++ b/pkg/docgen/lib/src/models/typedef.dart
@@ -6,8 +6,6 @@ library docgen.models.typedef;
import '../exports/source_mirrors.dart';
-import 'package:markdown/markdown.dart' as markdown;
-
import '../library_helpers.dart';
import 'dummy_mirror.dart';
@@ -17,7 +15,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 +59,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
+ /// 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
Emily Fortuna 2014/04/21 16:34:23 comments start with a capital letter, and end with
kevmoo 2014/04/21 17:52:15 This was a copy-paste from Method.dart I've disco
+ // 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';

Powered by Google App Engine
This is Rietveld 408576698