refactor(ngcc): use bundle src to create reflection hosts (#34254)

Previously individual properties of the src bundle program were
passed to the reflection host constructors. But going forward,
more properties will be required. To prevent the signature getting
continually larger and more unwieldy, this change just passes the
whole src bundle to the constructor, allowing it to extract what it
needs.

PR Close #34254
This commit is contained in:
Pete Bacon Darwin
2019-12-18 14:03:04 +00:00
committed by Kara Erickson
parent 5ec4fb2f2a
commit b2a8466e45
24 changed files with 1428 additions and 1459 deletions

View File

@ -18,10 +18,12 @@ export class UmdReflectionHost extends Esm5ReflectionHost {
protected umdModules = new Map<ts.SourceFile, UmdModule|null>();
protected umdExports = new Map<ts.SourceFile, Map<string, Declaration>|null>();
protected umdImportPaths = new Map<ts.ParameterDeclaration, string|null>();
constructor(
logger: Logger, isCore: boolean, protected program: ts.Program,
protected compilerHost: ts.CompilerHost, dts?: BundleProgram|null) {
super(logger, isCore, program.getTypeChecker(), dts);
protected program: ts.Program;
protected compilerHost: ts.CompilerHost;
constructor(logger: Logger, isCore: boolean, src: BundleProgram, dts?: BundleProgram|null) {
super(logger, isCore, src, dts);
this.program = src.program;
this.compilerHost = src.host;
}
getImportOfIdentifier(id: ts.Identifier): Import|null {