X Tutup
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 6 additions & 2 deletions modules/angular2/test/core/reflection/reflector_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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", () => {
Expand Down
X Tutup