Chromium Code Reviews| Index: pkg/docgen/lib/docgen.dart |
| diff --git a/pkg/docgen/lib/docgen.dart b/pkg/docgen/lib/docgen.dart |
| index 72588c80027d366b598c35327a2fff0f97300f6c..b036c6d3011db62ba37f7462c2bd3fc3ea33937a 100644 |
| --- a/pkg/docgen/lib/docgen.dart |
| +++ b/pkg/docgen/lib/docgen.dart |
| @@ -269,6 +269,7 @@ bool _isLibraryPrivate(LibraryMirror mirror) { |
| /** |
| * A declaration is private if itself is private, or the owner is private. |
| */ |
| +// Issue(12202) - A declaration is public even if it's owner is private. |
| bool _isPrivate(DeclarationMirror mirror) { |
|
Bob Nystrom
2013/08/02 15:36:04
I worry about using "private" here because this de
janicejl
2013/08/02 22:08:07
Done.
|
| if (mirror is LibraryMirror) { |
| return _isLibraryPrivate(mirror); |
| @@ -287,9 +288,18 @@ bool _filterPrivate(Indexable item) { |
| * Returns a list of meta annotations assocated with a mirror. |
| */ |
| List<String> _annotations(DeclarationMirror mirror) { |
| - var annotations = mirror.metadata.where((e) => |
| + var annotationMirrors = mirror.metadata.where((e) => |
| e is dart2js.Dart2JsConstructedConstantMirror); |
| - return annotations.map((e) => e.type.qualifiedName).toList(); |
| + var annotations = []; |
| + annotationMirrors.forEach((annotation) { |
| + var parameterList = []; |
| + annotation.type.variables.values.where((e) => e.isFinal).forEach ((v) { |
| + parameterList.add(annotation.getField(v.simpleName).reflectee); |
| + }); |
|
Bob Nystrom
2013/08/02 15:36:04
When you iterate over a sequence and call .add() o
janicejl
2013/08/02 22:08:07
Done.
|
| + annotations.add(new Annotation(annotation.type.qualifiedName, |
| + parameterList)); |
| + }); |
| + return annotations; |
| } |
| /** |
| @@ -723,7 +733,7 @@ class Typedef extends Indexable { |
| 'comment': comment, |
| 'return': returnType, |
| 'parameters': recurseMap(parameters), |
| - 'annotations': new List.from(annotations), |
| + 'annotations': new List.from(annotations.map((a) => a.toMap())), |
|
Bob Nystrom
2013/08/02 15:36:04
Instead of new List.from(), use toList():
annotat
janicejl
2013/08/02 22:08:07
Done.
|
| 'generics': recurseMap(generics) |
| }; |
| } |
| @@ -754,7 +764,7 @@ class Variable extends Indexable { |
| 'static': isStatic.toString(), |
| 'constant': isConst.toString(), |
| 'type': new List.filled(1, type.toMap()), |
| - 'annotations': new List.from(annotations) |
| + 'annotations': new List.from(annotations.map((a) => a.toMap())) |
| }; |
| } |
| @@ -789,7 +799,7 @@ class Method extends Indexable { |
| 'constant': isConst.toString(), |
| 'return': new List.filled(1, returnType.toMap()), |
| 'parameters': recurseMap(parameters), |
| - 'annotations': new List.from(annotations) |
| + 'annotations': new List.from(annotations.map((a) => a.toMap())) |
| }; |
| } |
| @@ -875,7 +885,7 @@ class Parameter { |
| 'default': hasDefaultValue.toString(), |
| 'type': new List.filled(1, type.toMap()), |
| 'value': defaultValue, |
| - 'annotations': new List.from(annotations) |
| + 'annotations': new List.from(annotations.map((a) => a.toMap())) |
| }; |
| } |
| @@ -934,4 +944,19 @@ class Type { |
| 'outer': outer, |
| 'inner': new List.from(inner.map((e) => e.toMap())) |
| }; |
| +} |
| + |
| +/** |
| + * Holds the name of the annotation, and its parameters. |
| + */ |
| +class Annotation { |
| + String qualifiedName; |
| + List<String> parameters; |
| + |
| + Annotation(this.qualifiedName, this.parameters); |
| + |
| + Map toMap() => { |
| + 'name': qualifiedName, |
| + 'metaparameters': new List.from(parameters) |
|
Bob Nystrom
2013/08/02 15:36:04
Why "metaparameters" and not just "parameters"?
I
janicejl
2013/08/02 22:08:07
Done.
|
| + }; |
| } |