fix(compiler): fix inheritance for AOT with summaries (#15583)

Allows to inherit ctor args, lifecycle hooks and statics from a class
in another compilation unit. 
Will error if trying to inherit from a class in another compilation unit 
that has an `@Component` / `@Directive` / `@Pipe` / `@NgModule`.
This commit is contained in:
Tobias Bosch
2017-03-30 14:51:29 -07:00
committed by Alex Rickabaugh
parent 28bf222a6a
commit 8ef621ad2a
13 changed files with 436 additions and 55 deletions

View File

@ -307,6 +307,17 @@ export class StaticSymbolResolver {
private createResolvedSymbol(
sourceSymbol: StaticSymbol, topLevelPath: string, topLevelSymbolNames: Set<string>,
metadata: any): ResolvedStaticSymbol {
// For classes that don't have Angular summaries / metadata,
// we only keep their arity, but nothing else
// (e.g. their constructor parameters).
// We do this to prevent introducing deep imports
// as we didn't generate .ngfactory.ts files with proper reexports.
if (this.summaryResolver.isLibraryFile(sourceSymbol.filePath) && metadata &&
metadata['__symbolic'] === 'class') {
const transformedMeta = {__symbolic: 'class', arity: metadata.arity};
return new ResolvedStaticSymbol(sourceSymbol, transformedMeta);
}
const self = this;
class ReferenceTransformer extends ValueTransformer {