refactor(ivy): don't pass LView where only TView is needed (#31490)
PR Close #31490
This commit is contained in:
parent
6f50aad5c4
commit
7014b67e51
|
@ -185,7 +185,7 @@ export function createRootComponentView(
|
||||||
rootView[HEADER_OFFSET], tNode, rendererFactory, renderer, sanitizer);
|
rootView[HEADER_OFFSET], tNode, rendererFactory, renderer, sanitizer);
|
||||||
|
|
||||||
if (tView.firstTemplatePass) {
|
if (tView.firstTemplatePass) {
|
||||||
diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, rootView), rootView, def.type);
|
diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, rootView), tView, def.type);
|
||||||
tNode.flags = TNodeFlags.isComponent;
|
tNode.flags = TNodeFlags.isComponent;
|
||||||
initNodeFlags(tNode, rootView.length, 1);
|
initNodeFlags(tNode, rootView.length, 1);
|
||||||
queueComponentIndexForCheck(tNode);
|
queueComponentIndexForCheck(tNode);
|
||||||
|
|
|
@ -230,8 +230,8 @@ export function getParentInjectorLocation(tNode: TNode, view: LView): RelativeIn
|
||||||
* @param token The type or the injection token to be made public
|
* @param token The type or the injection token to be made public
|
||||||
*/
|
*/
|
||||||
export function diPublicInInjector(
|
export function diPublicInInjector(
|
||||||
injectorIndex: number, view: LView, token: InjectionToken<any>| Type<any>): void {
|
injectorIndex: number, tView: TView, token: InjectionToken<any>| Type<any>): void {
|
||||||
bloomAdd(injectorIndex, view[TVIEW], token);
|
bloomAdd(injectorIndex, tView, token);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -72,6 +72,7 @@ function resolveProvider(
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const lView = getLView();
|
const lView = getLView();
|
||||||
|
const tView = lView[TVIEW];
|
||||||
let token: any = isTypeProvider(provider) ? provider : resolveForwardRef(provider.provide);
|
let token: any = isTypeProvider(provider) ? provider : resolveForwardRef(provider.provide);
|
||||||
let providerFactory: () => any = providerToFactory(provider);
|
let providerFactory: () => any = providerToFactory(provider);
|
||||||
|
|
||||||
|
@ -86,7 +87,6 @@ function resolveProvider(
|
||||||
const ngOnDestroy = prototype.ngOnDestroy;
|
const ngOnDestroy = prototype.ngOnDestroy;
|
||||||
|
|
||||||
if (ngOnDestroy) {
|
if (ngOnDestroy) {
|
||||||
const tView = lView[TVIEW];
|
|
||||||
(tView.destroyHooks || (tView.destroyHooks = [])).push(tInjectables.length, ngOnDestroy);
|
(tView.destroyHooks || (tView.destroyHooks = [])).push(tInjectables.length, ngOnDestroy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ function resolveProvider(
|
||||||
diPublicInInjector(
|
diPublicInInjector(
|
||||||
getOrCreateNodeInjectorForNode(
|
getOrCreateNodeInjectorForNode(
|
||||||
tNode as TElementNode | TContainerNode | TElementContainerNode, lView),
|
tNode as TElementNode | TContainerNode | TElementContainerNode, lView),
|
||||||
lView, token);
|
tView, token);
|
||||||
tInjectables.push(token);
|
tInjectables.push(token);
|
||||||
tNode.directiveStart++;
|
tNode.directiveStart++;
|
||||||
tNode.directiveEnd++;
|
tNode.directiveEnd++;
|
||||||
|
@ -151,7 +151,7 @@ function resolveProvider(
|
||||||
diPublicInInjector(
|
diPublicInInjector(
|
||||||
getOrCreateNodeInjectorForNode(
|
getOrCreateNodeInjectorForNode(
|
||||||
tNode as TElementNode | TContainerNode | TElementContainerNode, lView),
|
tNode as TElementNode | TContainerNode | TElementContainerNode, lView),
|
||||||
lView, token);
|
tView, token);
|
||||||
const factory = multiFactory(
|
const factory = multiFactory(
|
||||||
isViewProvider ? multiViewProvidersFactoryResolver : multiProvidersFactoryResolver,
|
isViewProvider ? multiViewProvidersFactoryResolver : multiProvidersFactoryResolver,
|
||||||
lInjectablesBlueprint.length, isViewProvider, isComponent, providerFactory);
|
lInjectablesBlueprint.length, isViewProvider, isComponent, providerFactory);
|
||||||
|
|
|
@ -1208,7 +1208,7 @@ function findDirectiveMatches(tView: TView, viewData: LView, tNode: TNode): Dire
|
||||||
getOrCreateNodeInjectorForNode(
|
getOrCreateNodeInjectorForNode(
|
||||||
getPreviousOrParentTNode() as TElementNode | TContainerNode | TElementContainerNode,
|
getPreviousOrParentTNode() as TElementNode | TContainerNode | TElementContainerNode,
|
||||||
viewData),
|
viewData),
|
||||||
viewData, def.type);
|
tView, def.type);
|
||||||
|
|
||||||
if (isComponentDef(def)) {
|
if (isComponentDef(def)) {
|
||||||
if (tNode.flags & TNodeFlags.isComponent) throwMultipleComponentError(tNode);
|
if (tNode.flags & TNodeFlags.isComponent) throwMultipleComponentError(tNode);
|
||||||
|
|
Loading…
Reference in New Issue