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

Unified Diff: dart/sdk/lib/_internal/lib/js_mirrors.dart

Issue 23226002: Implement ClassMirror.superinterfaces. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments Created 7 years, 4 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 | « dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart ('k') | dart/tests/lib/lib.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/sdk/lib/_internal/lib/js_mirrors.dart
diff --git a/dart/sdk/lib/_internal/lib/js_mirrors.dart b/dart/sdk/lib/_internal/lib/js_mirrors.dart
index 3914b203eb3ca8dc06d9f400c4cca8d2c0a48c40..18326b91e8ec432840c4daa7fc1fd1f1a37e606f 100644
--- a/dart/sdk/lib/_internal/lib/js_mirrors.dart
+++ b/dart/sdk/lib/_internal/lib/js_mirrors.dart
@@ -522,7 +522,7 @@ class JsMixinApplication extends JsTypeMirror with JsObjectMirror
throw new NoSuchMethodError(this, '${n(fieldName)}=', [arg], null);
}
- List<ClassMirror> get superinterfaces => mixin.superinterfaces;
+ List<ClassMirror> get superinterfaces => [mixin];
Map<Symbol, MethodMirror> get constructors => mixin.constructors;
@@ -688,6 +688,7 @@ class JsClassMirror extends JsTypeMirror with JsObjectMirror
UnmodifiableMapView<Symbol, VariableMirror> _cachedVariables;
UnmodifiableMapView<Symbol, Mirror> _cachedMembers;
UnmodifiableListView<InstanceMirror> _cachedMetadata;
+ UnmodifiableListView<ClassMirror> _cachedSuperinterfaces;
// Set as side-effect of accessing JsLibraryMirror.classes.
JsLibraryMirror _owner;
@@ -868,6 +869,8 @@ class JsClassMirror extends JsTypeMirror with JsObjectMirror
// Filter-out setters corresponding to variables.
if (result[s(name)] is VariableMirror) continue;
}
+ // Constructors aren't 'members'.
+ if (method.isConstructor) continue;
// Use putIfAbsent to filter-out getters corresponding to variables.
result.putIfAbsent(method.simpleName, () => method);
}
@@ -1013,8 +1016,22 @@ class JsClassMirror extends JsTypeMirror with JsObjectMirror
ClassMirror get originalDeclaration => this;
+ List<ClassMirror> get superinterfaces {
+ if (_cachedSuperinterfaces != null) return _cachedSuperinterfaces;
+ List<int> interfaces = JS('List|Null', 'init.interfaces[#]', _mangledName);
+ var result = const [];
+ if (interfaces != null) {
+ ClassMirror lookupType(int i) {
+ var type = JS('=Object', 'init.metadata[#]', i);
+ return typeMirrorFromRuntimeTypeRepresentation(type);
+ }
+ result = interfaces.map(lookupType).toList();
+ }
+ return _cachedSuperinterfaces =
+ new UnmodifiableListView<ClassMirror>(result);
+ }
+
// TODO(ahe): Implement these.
- List<ClassMirror> get superinterfaces => throw new UnimplementedError();
Map<Symbol, TypeVariableMirror> get typeVariables
=> throw new UnimplementedError();
Map<Symbol, TypeMirror> get typeArguments => throw new UnimplementedError();
« no previous file with comments | « dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart ('k') | dart/tests/lib/lib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698