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

Unified Diff: pkg/docgen/lib/src/models/variable.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 indent-json 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
« no previous file with comments | « pkg/docgen/lib/src/models/typedef.dart ('k') | pkg/docgen/test/multi_library_code/lib/root_lib.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/docgen/lib/src/models/variable.dart
diff --git a/pkg/docgen/lib/src/models/variable.dart b/pkg/docgen/lib/src/models/variable.dart
index f89bef156048a00bdc084c9b4a24a81401e67668..2d8b02a2b7c3b51ffc93178f1918d9005c19983c 100644
--- a/pkg/docgen/lib/src/models/variable.dart
+++ b/pkg/docgen/lib/src/models/variable.dart
@@ -16,32 +16,27 @@ import 'owned_indexable.dart';
/// A class containing properties of a Dart variable.
-class Variable extends OwnedIndexable {
-
- bool isFinal;
- bool isStatic;
- bool isConst;
- DocGenType type;
- String _variableName;
-
- factory Variable(String variableName, VariableMirror mirror,
- Indexable owner) {
+class Variable extends OwnedIndexable<VariableMirror> {
+ final bool isFinal;
+ final bool isStatic;
+ final bool isConst;
+ final DocGenType type;
+ final String name;
+
+ factory Variable(String name, VariableMirror mirror, Indexable owner) {
var variable = getDocgenObject(mirror);
if (variable is DummyMirror) {
- return new Variable._(variableName, mirror, owner);
+ return new Variable._(name, mirror, owner);
}
return variable;
}
- Variable._(this._variableName, VariableMirror mirror, Indexable owner) :
- super(mirror, owner) {
- isFinal = mirror.isFinal;
- isStatic = mirror.isStatic;
- isConst = mirror.isConst;
- type = new DocGenType(mirror.type, owner.owningLibrary);
- }
-
- String get name => _variableName;
+ Variable._(this.name, VariableMirror mirror, Indexable owner)
+ : isFinal = mirror.isFinal,
+ isStatic = mirror.isStatic,
+ isConst = mirror.isConst,
+ type = new DocGenType(mirror.type, owner.owningLibrary),
+ super(mirror, owner);
/// Generates a map describing the [Variable] object.
Map toMap() => {
@@ -57,7 +52,7 @@ class Variable extends OwnedIndexable {
String get typeName => 'property';
- get comment {
+ String get comment {
if (commentField != null) return commentField;
if (owner is Class) {
(owner as Class).ensureComments();
@@ -65,23 +60,5 @@ class Variable extends OwnedIndexable {
return super.comment;
}
- String findElementInScope(String name) {
- var lookupFunc = determineLookupFunc(name);
- var result = lookupFunc(mirror, name);
- if (result != null) {
- result = getDocgenObject(result);
- 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);
- }
-
bool isValidMirror(DeclarationMirror mirror) => mirror is VariableMirror;
}
« no previous file with comments | « pkg/docgen/lib/src/models/typedef.dart ('k') | pkg/docgen/test/multi_library_code/lib/root_lib.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698