diff --git a/modules/angular2/src/core/reflection/reflection_capabilities.dart b/modules/angular2/src/core/reflection/reflection_capabilities.dart index fe9211466d..9fff8f5de7 100644 --- a/modules/angular2/src/core/reflection/reflection_capabilities.dart +++ b/modules/angular2/src/core/reflection/reflection_capabilities.dart @@ -272,8 +272,13 @@ class ReflectionCapabilities implements PlatformReflectionCapabilities { } List interfaces(type) { - ClassMirror classMirror = reflectType(type); - return classMirror.superinterfaces.map((si) => si.reflectedType).toList(); + return _interfacesFromMirror(reflectType(type)); + } + + List _interfacesFromMirror(classMirror) { + return classMirror.superinterfaces.map((si) => si.reflectedType).toList() + ..addAll(classMirror.superclass == null ? [] + : _interfacesFromMirror(classMirror.superclass)); } GetterFn getter(String name) { diff --git a/modules/angular2/test/core/reflection/reflector_spec.ts b/modules/angular2/test/core/reflection/reflector_spec.ts index 273b9e77cd..28753a7bf0 100644 --- a/modules/angular2/test/core/reflection/reflector_spec.ts +++ b/modules/angular2/test/core/reflection/reflector_spec.ts @@ -51,7 +51,11 @@ class TestObj { class Interface {} -class ClassImplementingInterface implements Interface {} +class Interface2 {} + +class SuperClassImplementingInterface implements Interface2 {} + +class ClassImplementingInterface extends SuperClassImplementingInterface implements Interface {} export function main() { describe('Reflector', () => { @@ -191,7 +195,7 @@ export function main() { describe("interfaces", () => { it("should return an array of interfaces for a type", () => { var p = reflector.interfaces(ClassImplementingInterface); - expect(p).toEqual([Interface]); + expect(p).toEqual([Interface, Interface2]); }); it("should return an empty array otherwise", () => {