refactor(ivy): Remove findComponentView since we now store it in LView[DECLARATION_COMPONENT_VIEW] (#33810)

PR Close #33810
This commit is contained in:
Miško Hevery
2019-11-13 16:22:55 -08:00
committed by Alex Rickabaugh
parent 8f034896a3
commit 7c64b1889f
13 changed files with 24 additions and 64 deletions

View File

@ -8,14 +8,11 @@
import {assertDefined} from '../../util/assert';
import {assertLView} from '../assert';
import {TNodeType} from '../interfaces/node';
import {isLContainer, isLView} from '../interfaces/type_checks';
import {CONTEXT, DECLARATION_VIEW, FLAGS, LView, LViewFlags, PARENT, RootContext, T_HOST} from '../interfaces/view';
import {CONTEXT, FLAGS, LView, LViewFlags, PARENT, RootContext} from '../interfaces/view';
import {readPatchedLView} from './view_utils';
/**
* Gets the parent LView of the passed LView, if the PARENT is an LContainer, will get the parent of
* that LContainer, which is an LView
@ -43,29 +40,6 @@ export function getRootView(componentOrLView: LView | {}): LView {
return lView;
}
/**
* Given an `LView`, find the closest declaration view which is not an embedded view.
*
* This method searches for the `LView` associated with the component which declared the `LView`.
*
* This function may return itself if the `LView` passed in is not an embedded `LView`. Otherwise
* it walks the declaration parents until it finds a component view (non-embedded-view.)
*
* @param lView LView for which we want a host element node
* @returns The host node
*/
export function findComponentView(lView: LView): LView {
let rootTNode = lView[T_HOST];
let declaredView: LView|null;
while (rootTNode !== null && rootTNode.type === TNodeType.View &&
(declaredView = lView[DECLARATION_VIEW]) !== null) {
lView = declaredView;
rootTNode = lView[T_HOST];
}
ngDevMode && assertLView(lView);
return lView;
}
/**
* Returns the `RootContext` instance that is associated with
* the application where the target is situated. It does this by walking the parent views until it