fix(compiler): ignore errors when evaluating base classes (#15560)

Fixes #15536
This commit is contained in:
Chuck Jazdzewski
2017-03-28 13:32:34 -07:00
committed by Victor Berchet
parent 8e03f65645
commit d438b88f19
2 changed files with 28 additions and 3 deletions

View File

@ -495,6 +495,31 @@ describe('StaticReflector', () => {
expect(() => reflector.propMetadata(appComponent)).not.toThrow();
});
it('should not throw with an invalid extends', () => {
const data = Object.create(DEFAULT_TEST_DATA);
const file = '/tmp/src/invalid-component.ts';
data[file] = `
import {Component} from '@angular/core';
function InvalidParent() {
return InvalidParent;
}
@Component({
selector: 'tmp',
template: '',
})
export class BadComponent extends InvalidParent() {
}
`;
init(data);
const badComponent = reflector.getStaticSymbol(file, 'BadComponent');
expect(reflector.propMetadata(badComponent)).toEqual({});
expect(reflector.parameters(badComponent)).toEqual([]);
expect(reflector.hasLifecycleHook(badComponent, 'onDestroy')).toEqual(false);
});
it('should produce a annotation even if it contains errors', () => {
const data = Object.create(DEFAULT_TEST_DATA);
const file = '/tmp/src/invalid-component.ts';