perf(core): Avoid unnecessary creating provider factory (#33742)

In providerToRecord move creating the factory into a condition which
actually needs it to avoid unnecessary creating it

PR Close #33742
This commit is contained in:
NothingEverHappens 2019-11-11 15:57:10 -05:00 committed by Kara Erickson
parent 2ce9cdab9d
commit ccee818034
1 changed files with 1 additions and 1 deletions

View File

@ -461,10 +461,10 @@ function getUndecoratedInjectableFactory(token: Function) {
function providerToRecord(
provider: SingleProvider, ngModuleType: InjectorType<any>, providers: any[]): Record<any> {
let factory: (() => any)|undefined = providerToFactory(provider, ngModuleType, providers);
if (isValueProvider(provider)) {
return makeRecord(undefined, provider.useValue);
} else {
const factory: (() => any)|undefined = providerToFactory(provider, ngModuleType, providers);
return makeRecord(factory, NOT_YET);
}
}