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:
parent
2ce9cdab9d
commit
ccee818034
|
@ -461,10 +461,10 @@ function getUndecoratedInjectableFactory(token: Function) {
|
||||||
|
|
||||||
function providerToRecord(
|
function providerToRecord(
|
||||||
provider: SingleProvider, ngModuleType: InjectorType<any>, providers: any[]): Record<any> {
|
provider: SingleProvider, ngModuleType: InjectorType<any>, providers: any[]): Record<any> {
|
||||||
let factory: (() => any)|undefined = providerToFactory(provider, ngModuleType, providers);
|
|
||||||
if (isValueProvider(provider)) {
|
if (isValueProvider(provider)) {
|
||||||
return makeRecord(undefined, provider.useValue);
|
return makeRecord(undefined, provider.useValue);
|
||||||
} else {
|
} else {
|
||||||
|
const factory: (() => any)|undefined = providerToFactory(provider, ngModuleType, providers);
|
||||||
return makeRecord(factory, NOT_YET);
|
return makeRecord(factory, NOT_YET);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue