refactor(ngcc): avoid returning the same top-level helper calls multiple times (#34512)

This change should not have any impact on the code's behavior (based on
how the function is currently used), but it will avoid unnecessary work.

PR Close #34512
This commit is contained in:
George Kalpakas 2019-12-25 02:05:03 +02:00 committed by Alex Rickabaugh
parent 17d5e2bc99
commit 6606ce69f6

View File

@ -95,7 +95,7 @@ export class CommonJsReflectionHost extends Esm5ReflectionHost {
const helperCallsMap = getOrDefault(this.topLevelHelperCalls, helperName, () => new Map()); const helperCallsMap = getOrDefault(this.topLevelHelperCalls, helperName, () => new Map());
calls.push(...getOrDefault( calls.push(...getOrDefault(
helperCallsMap, sourceFile, helperCallsMap, sourceFile,
() => sourceFile.statements.map(statement => this.getHelperCall(statement, helperNames)) () => sourceFile.statements.map(statement => this.getHelperCall(statement, [helperName]))
.filter(isDefined))); .filter(isDefined)));
}); });
return calls; return calls;