fix(compiler): don't typecheck all inputs (#22899)

ngc knows to filter out d.ts inputs, but the logic accidentally
depended on whether it had a previous Program lying around.

Fixing that logic puts ngc on the fast code path, but in that code
path it must be able to merge tsickle EmitResults, so we need to
plumb the tsickle.mergeEmitResults function through all the intervening
APIs.  The bulk of this change is that plumbing.

PR Close #22899
This commit is contained in:
Rado Kirov
2018-03-20 16:11:20 -07:00
committed by Matias Niemelä
parent f461f43d72
commit 838a610197
4 changed files with 36 additions and 18 deletions

View File

@ -186,6 +186,7 @@ export function exitCodeFromResult(diags: Diagnostics | undefined): number {
}
export function performCompilation({rootNames, options, host, oldProgram, emitCallback,
mergeEmitResultsCallback,
gatherDiagnostics = defaultGatherDiagnostics,
customTransformers, emitFlags = api.EmitFlags.Default}: {
rootNames: string[],
@ -193,6 +194,7 @@ export function performCompilation({rootNames, options, host, oldProgram, emitCa
host?: api.CompilerHost,
oldProgram?: api.Program,
emitCallback?: api.TsEmitCallback,
mergeEmitResultsCallback?: api.TsMergeEmitResultsCallback,
gatherDiagnostics?: (program: api.Program) => Diagnostics,
customTransformers?: api.CustomTransformers,
emitFlags?: api.EmitFlags
@ -216,7 +218,8 @@ export function performCompilation({rootNames, options, host, oldProgram, emitCa
}
if (!hasErrors(allDiagnostics)) {
emitResult = program !.emit({emitCallback, customTransformers, emitFlags});
emitResult =
program !.emit({emitCallback, mergeEmitResultsCallback, customTransformers, emitFlags});
allDiagnostics.push(...emitResult.diagnostics);
return {diagnostics: allDiagnostics, program, emitResult};
}