refactor(ivy): don't pass LView where only TView is needed (#31490)

PR Close #31490
This commit is contained in:
Pawel Kozlowski 2019-07-10 17:53:42 +02:00 committed by Matias Niemelä
parent 6f50aad5c4
commit 7014b67e51
4 changed files with 7 additions and 7 deletions

View File

@ -185,7 +185,7 @@ export function createRootComponentView(
rootView[HEADER_OFFSET], tNode, rendererFactory, renderer, sanitizer);
if (tView.firstTemplatePass) {
diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, rootView), rootView, def.type);
diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, rootView), tView, def.type);
tNode.flags = TNodeFlags.isComponent;
initNodeFlags(tNode, rootView.length, 1);
queueComponentIndexForCheck(tNode);

View File

@ -230,8 +230,8 @@ export function getParentInjectorLocation(tNode: TNode, view: LView): RelativeIn
* @param token The type or the injection token to be made public
*/
export function diPublicInInjector(
injectorIndex: number, view: LView, token: InjectionToken<any>| Type<any>): void {
bloomAdd(injectorIndex, view[TVIEW], token);
injectorIndex: number, tView: TView, token: InjectionToken<any>| Type<any>): void {
bloomAdd(injectorIndex, tView, token);
}
/**

View File

@ -72,6 +72,7 @@ function resolveProvider(
}
} else {
const lView = getLView();
const tView = lView[TVIEW];
let token: any = isTypeProvider(provider) ? provider : resolveForwardRef(provider.provide);
let providerFactory: () => any = providerToFactory(provider);
@ -86,7 +87,6 @@ function resolveProvider(
const ngOnDestroy = prototype.ngOnDestroy;
if (ngOnDestroy) {
const tView = lView[TVIEW];
(tView.destroyHooks || (tView.destroyHooks = [])).push(tInjectables.length, ngOnDestroy);
}
}
@ -101,7 +101,7 @@ function resolveProvider(
diPublicInInjector(
getOrCreateNodeInjectorForNode(
tNode as TElementNode | TContainerNode | TElementContainerNode, lView),
lView, token);
tView, token);
tInjectables.push(token);
tNode.directiveStart++;
tNode.directiveEnd++;
@ -151,7 +151,7 @@ function resolveProvider(
diPublicInInjector(
getOrCreateNodeInjectorForNode(
tNode as TElementNode | TContainerNode | TElementContainerNode, lView),
lView, token);
tView, token);
const factory = multiFactory(
isViewProvider ? multiViewProvidersFactoryResolver : multiProvidersFactoryResolver,
lInjectablesBlueprint.length, isViewProvider, isComponent, providerFactory);

View File

@ -1208,7 +1208,7 @@ function findDirectiveMatches(tView: TView, viewData: LView, tNode: TNode): Dire
getOrCreateNodeInjectorForNode(
getPreviousOrParentTNode() as TElementNode | TContainerNode | TElementContainerNode,
viewData),
viewData, def.type);
tView, def.type);
if (isComponentDef(def)) {
if (tNode.flags & TNodeFlags.isComponent) throwMultipleComponentError(tNode);