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

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

Issue 243423005: Partial fix for Angular Annotations viewed in Docgen. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/docgen/lib/src/models/annotation.dart
diff --git a/pkg/docgen/lib/src/models/annotation.dart b/pkg/docgen/lib/src/models/annotation.dart
index 0cc97c6e20f37077e667136ab2648cdd5097020a..ac4791f311f892810973bf3ed1fff24807d91644 100644
--- a/pkg/docgen/lib/src/models/annotation.dart
+++ b/pkg/docgen/lib/src/models/annotation.dart
@@ -21,8 +21,26 @@ class Annotation extends MirrorBased {
Annotation(InstanceMirror originalMirror, this.owningLibrary)
: mirror = originalMirror.type {
- parameters = dart2js_util.variablesOf(originalMirror.type.declarations)
- .where((e) => e.isFinal)
+ var curMirror = originalMirror.type;
+ Map<Symbol, DeclarationMirror> allDeclarations =
+ new Map.from(curMirror.declarations);
+ // This method assumes that our users aren't creating deep inheritance
+ // chains of custom annotation inheritance. If this is not the case,
+ // re-write this section for performance.
+ while (curMirror.superclass != null &&
+ curMirror.superclass.simpleName.toString() != 'Object') {
+ allDeclarations.addAll(curMirror.superclass.declarations);
+ curMirror = curMirror.superclass;
+ }
+
+ // TODO(efortuna): Some originalMirrors, such as the
+ // Dart2JsMapConstantMirror and Dart2JsListConstantMirror don't have a
+ // reflectee field, but we want the value of the parameter from them.
+ // Gross workaround is to assemble the object manually.
+ // See issue 18346.
+ parameters = dart2js_util.variablesOf(allDeclarations)
+ .where((e) => e.isFinal &&
+ originalMirror.getField(e.simpleName).hasReflectee)
.map((e) => originalMirror.getField(e.simpleName).reflectee)
.where((e) => e != null)
.toList();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698