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

Unified Diff: pkg/dartdoc/lib/src/mirrors/dart2js_mirror.dart

Issue 11342039: LibraryMirror interface updated to match dart:mirrors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comment Created 8 years, 2 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/dartdoc/lib/mirrors_util.dart ('k') | tests/compiler/dart2js/mirrors_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/dartdoc/lib/src/mirrors/dart2js_mirror.dart
diff --git a/pkg/dartdoc/lib/src/mirrors/dart2js_mirror.dart b/pkg/dartdoc/lib/src/mirrors/dart2js_mirror.dart
index f521fb63a14ed187869b84303a085840855b1544..515d39e63d5ea21dbebbcd6ecc4370b37f84eeb9 100644
--- a/pkg/dartdoc/lib/src/mirrors/dart2js_mirror.dart
+++ b/pkg/dartdoc/lib/src/mirrors/dart2js_mirror.dart
@@ -484,7 +484,7 @@ abstract class Dart2JsObjectMirror extends Dart2JsElementMirror
class Dart2JsLibraryMirror extends Dart2JsObjectMirror
implements LibraryMirror {
- Map<String, ClassMirror> _types;
+ Map<String, ClassMirror> _classes;
Map<String, MemberMirror> _members;
Dart2JsLibraryMirror(Dart2JsMirrorSystem system, LibraryElement library)
@@ -523,24 +523,24 @@ class Dart2JsLibraryMirror extends Dart2JsObjectMirror
String get qualifiedName => simpleName;
- void _ensureTypes() {
- if (_types == null) {
- _types = <String, ClassMirror>{};
+ void _ensureClasses() {
+ if (_classes == null) {
+ _classes = <String, ClassMirror>{};
_library.forEachLocalMember((Element e) {
if (e.isClass()) {
e.ensureResolved(system.compiler);
var type = new Dart2JsClassMirror.fromLibrary(this, e);
- assert(invariant(_library, !_types.containsKey(type.simpleName),
+ assert(invariant(_library, !_classes.containsKey(type.simpleName),
message: "Type name '${type.simpleName}' "
"is not unique in $_library."));
- _types[type.simpleName] = type;
+ _classes[type.simpleName] = type;
} else if (e.isTypedef()) {
var type = new Dart2JsTypedefMirror.fromLibrary(this,
e.computeType(system.compiler));
- assert(invariant(_library, !_types.containsKey(type.simpleName),
+ assert(invariant(_library, !_classes.containsKey(type.simpleName),
message: "Type name '${type.simpleName}' "
"is not unique in $_library."));
- _types[type.simpleName] = type;
+ _classes[type.simpleName] = type;
}
});
}
@@ -565,9 +565,29 @@ class Dart2JsLibraryMirror extends Dart2JsObjectMirror
return new ImmutableMapWrapper<String, MemberMirror>(_members);
}
- Map<String, ClassMirror> get types {
- _ensureTypes();
- return new ImmutableMapWrapper<String, ClassMirror>(_types);
+ Map<String, Mirror> get members => declaredMembers;
+
+ Map<String, MethodMirror> get functions {
+ _ensureMembers();
+ return new FilteredImmutableMap(_members,
+ (MemberMirror member) => member is MethodMirror);
+ }
+
+ Map<String, MethodMirror> get getters {
+ _ensureMembers();
+ return new FilteredImmutableMap(_members,
+ (MemberMirror member) => member is MethodMirror && member.isGetter);
+ }
+
+ Map<String, MethodMirror> get setters {
+ _ensureMembers();
+ return new FilteredImmutableMap(_members,
+ (MemberMirror member) => member is MethodMirror && member.isSetter);
+ }
+
+ Map<String, ClassMirror> get classes {
+ _ensureClasses();
+ return new ImmutableMapWrapper<String, ClassMirror>(_classes);
}
SourceLocation get location {
« no previous file with comments | « pkg/dartdoc/lib/mirrors_util.dart ('k') | tests/compiler/dart2js/mirrors_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698