diff --git a/packages/core/src/debug/debug_node.ts b/packages/core/src/debug/debug_node.ts index 9a8f4d41e4..e79f3c1e7c 100644 --- a/packages/core/src/debug/debug_node.ts +++ b/packages/core/src/debug/debug_node.ts @@ -18,7 +18,7 @@ import {getComponent, getContext, getInjectionTokens, getInjector, getListeners, import {INTERPOLATION_DELIMITER, renderStringify} from '../render3/util/misc_utils'; import {isStylingContext, stylingMapToStringMap} from '../render3/util/styling_utils'; import {findComponentView} from '../render3/util/view_traversal_utils'; -import {getComponentViewByIndex, getNativeByTNodeOrNull} from '../render3/util/view_utils'; +import {getComponentLViewByIndex, getNativeByTNodeOrNull} from '../render3/util/view_utils'; import {assertDomNode} from '../util/assert'; import {DebugContext} from '../view/index'; import {createProxy} from './proxy'; @@ -494,7 +494,7 @@ function _queryNodeChildrenR3( if (isComponentHost(tNode)) { // If the element is the host of a component, then all nodes in its view have to be processed. // Note: the component's content (tNode.child) will be processed from the insertion points. - const componentView = getComponentViewByIndex(tNode.index, lView); + const componentView = getComponentLViewByIndex(tNode.index, lView); if (componentView && componentView[TVIEW].firstChild) { _queryNodeChildrenR3( componentView[TVIEW].firstChild !, componentView, predicate, matches, elementsOnly, diff --git a/packages/core/src/render3/context_discovery.ts b/packages/core/src/render3/context_discovery.ts index 4899be7d46..5429aba0ed 100644 --- a/packages/core/src/render3/context_discovery.ts +++ b/packages/core/src/render3/context_discovery.ts @@ -14,7 +14,7 @@ import {LContext, MONKEY_PATCH_KEY_NAME} from './interfaces/context'; import {TNode, TNodeFlags} from './interfaces/node'; import {RElement, RNode} from './interfaces/renderer'; import {CONTEXT, HEADER_OFFSET, HOST, LView, TVIEW} from './interfaces/view'; -import {getComponentViewByIndex, getNativeByTNodeOrNull, readPatchedData, unwrapRNode} from './util/view_utils'; +import {getComponentLViewByIndex, getNativeByTNodeOrNull, readPatchedData, unwrapRNode} from './util/view_utils'; @@ -157,14 +157,14 @@ export function getComponentViewByInstance(componentInstance: {}): LView { if (Array.isArray(lView)) { const nodeIndex = findViaComponent(lView, componentInstance); - view = getComponentViewByIndex(nodeIndex, lView); + view = getComponentLViewByIndex(nodeIndex, lView); const context = createLContext(lView, nodeIndex, view[HOST] as RElement); context.component = componentInstance; attachPatchData(componentInstance, context); attachPatchData(context.native, context); } else { const context = lView as any as LContext; - view = getComponentViewByIndex(context.nodeIndex, context.lView); + view = getComponentLViewByIndex(context.nodeIndex, context.lView); } return view; } @@ -228,13 +228,13 @@ function findViaComponent(lView: LView, componentInstance: {}): number { if (componentIndices) { for (let i = 0; i < componentIndices.length; i++) { const elementComponentIndex = componentIndices[i]; - const componentView = getComponentViewByIndex(elementComponentIndex, lView); + const componentView = getComponentLViewByIndex(elementComponentIndex, lView); if (componentView[CONTEXT] === componentInstance) { return elementComponentIndex; } } } else { - const rootComponentView = getComponentViewByIndex(HEADER_OFFSET, lView); + const rootComponentView = getComponentLViewByIndex(HEADER_OFFSET, lView); const rootComponent = rootComponentView[CONTEXT]; if (rootComponent === componentInstance) { // we are dealing with the root element here therefore we know that the diff --git a/packages/core/src/render3/instructions/listener.ts b/packages/core/src/render3/instructions/listener.ts index e002ec85c9..5d7bebec50 100644 --- a/packages/core/src/render3/instructions/listener.ts +++ b/packages/core/src/render3/instructions/listener.ts @@ -16,7 +16,7 @@ import {isDirectiveHost} from '../interfaces/type_checks'; import {CLEANUP, FLAGS, LView, LViewFlags, RENDERER, TVIEW} from '../interfaces/view'; import {assertNodeOfPossibleTypes} from '../node_assert'; import {getLView, getPreviousOrParentTNode} from '../state'; -import {getComponentViewByIndex, getNativeByTNode, unwrapRNode} from '../util/view_utils'; +import {getComponentLViewByIndex, getNativeByTNode, unwrapRNode} from '../util/view_utils'; import {getCleanup, handleError, loadComponentRenderer, markViewDirty} from './shared'; /** @@ -248,7 +248,7 @@ function wrapListener( // In order to be backwards compatible with View Engine, events on component host nodes // must also mark the component view itself dirty (i.e. the view that it owns). const startView = tNode.flags & TNodeFlags.isComponentHost ? - getComponentViewByIndex(tNode.index, lView) : + getComponentLViewByIndex(tNode.index, lView) : lView; // See interfaces/view.ts for more on LViewFlags.ManualOnPush diff --git a/packages/core/src/render3/instructions/shared.ts b/packages/core/src/render3/instructions/shared.ts index 85157d0be3..a28e394246 100644 --- a/packages/core/src/render3/instructions/shared.ts +++ b/packages/core/src/render3/instructions/shared.ts @@ -36,7 +36,7 @@ import {NO_CHANGE} from '../tokens'; import {isAnimationProp} from '../util/attrs_utils'; import {INTERPOLATION_DELIMITER, renderStringify, stringifyForError} from '../util/misc_utils'; import {getLViewParent} from '../util/view_traversal_utils'; -import {getComponentViewByIndex, getNativeByIndex, getNativeByTNode, getTNode, isCreationMode, readPatchedLView, resetPreOrderHookFlags, unwrapRNode, viewAttachedToChangeDetector} from '../util/view_utils'; +import {getComponentLViewByIndex, getNativeByIndex, getNativeByTNode, getTNode, isCreationMode, readPatchedLView, resetPreOrderHookFlags, unwrapRNode, viewAttachedToChangeDetector} from '../util/view_utils'; import {selectIndexInternal} from './advance'; import {LCleanup, LViewBlueprint, MatchesArray, TCleanup, TNodeConstructor, TNodeInitialInputs, TNodeLocalNames, TViewComponents, TViewConstructor, attachLContainerDebug, attachLViewDebug, cloneToLView, cloneToTViewData} from './lview_debug'; @@ -936,7 +936,7 @@ export function elementPropertyInternal( /** If node is an OnPush component, marks its LView dirty. */ function markDirtyIfOnPush(lView: LView, viewIndex: number): void { ngDevMode && assertLView(lView); - const childComponentLView = getComponentViewByIndex(viewIndex, lView); + const childComponentLView = getComponentLViewByIndex(viewIndex, lView); if (!(childComponentLView[FLAGS] & LViewFlags.CheckAlways)) { childComponentLView[FLAGS] |= LViewFlags.Dirty; } @@ -1185,7 +1185,7 @@ function postProcessDirective( } if (isComponentDef(def)) { - const componentView = getComponentViewByIndex(hostTNode.index, lView); + const componentView = getComponentLViewByIndex(hostTNode.index, lView); componentView[CONTEXT] = directive; } } @@ -1502,7 +1502,7 @@ function refreshDynamicEmbeddedViews(lView: LView) { */ function refreshComponent(hostLView: LView, componentHostIdx: number): void { ngDevMode && assertEqual(isCreationMode(hostLView), false, 'Should be run in update mode'); - const componentView = getComponentViewByIndex(componentHostIdx, hostLView); + const componentView = getComponentLViewByIndex(componentHostIdx, hostLView); // Only attached components that are CheckAlways or OnPush and dirty should be refreshed if (viewAttachedToChangeDetector(componentView) && componentView[FLAGS] & (LViewFlags.CheckAlways | LViewFlags.Dirty)) { @@ -1513,7 +1513,7 @@ function refreshComponent(hostLView: LView, componentHostIdx: number): void { function renderComponent(hostLView: LView, componentHostIdx: number) { ngDevMode && assertEqual(isCreationMode(hostLView), true, 'Should be run in creation mode'); - const componentView = getComponentViewByIndex(componentHostIdx, hostLView); + const componentView = getComponentLViewByIndex(componentHostIdx, hostLView); syncViewWithBlueprint(componentView); renderView(componentView, componentView[TVIEW], componentView[CONTEXT]); } diff --git a/packages/core/src/render3/util/view_utils.ts b/packages/core/src/render3/util/view_utils.ts index 8de1909721..a9aa460d26 100644 --- a/packages/core/src/render3/util/view_utils.ts +++ b/packages/core/src/render3/util/view_utils.ts @@ -129,7 +129,7 @@ export function load(view: LView | TData, index: number): T { return view[index + HEADER_OFFSET]; } -export function getComponentViewByIndex(nodeIndex: number, hostView: LView): LView { +export function getComponentLViewByIndex(nodeIndex: number, hostView: LView): LView { // Could be an LView or an LContainer. If LContainer, unwrap to find LView. ngDevMode && assertDataInRange(hostView, nodeIndex); const slotValue = hostView[nodeIndex]; diff --git a/packages/core/src/render3/view_engine_compatibility.ts b/packages/core/src/render3/view_engine_compatibility.ts index af6df59399..5e062c7626 100644 --- a/packages/core/src/render3/view_engine_compatibility.ts +++ b/packages/core/src/render3/view_engine_compatibility.ts @@ -32,7 +32,7 @@ import {getParentInjectorTNode} from './node_util'; import {getLView, getPreviousOrParentTNode} from './state'; import {getParentInjectorView, hasParentInjector} from './util/injector_utils'; import {findComponentView} from './util/view_traversal_utils'; -import {getComponentViewByIndex, getNativeByTNode, unwrapRNode, viewAttachedToContainer} from './util/view_utils'; +import {getComponentLViewByIndex, getNativeByTNode, unwrapRNode, viewAttachedToContainer} from './util/view_utils'; import {ViewRef} from './view_ref'; @@ -379,7 +379,7 @@ function createViewRef( hostTNode: TNode, hostView: LView, isPipe: boolean): ViewEngine_ChangeDetectorRef { if (isComponentHost(hostTNode) && !isPipe) { const componentIndex = hostTNode.directiveStart; - const componentView = getComponentViewByIndex(hostTNode.index, hostView); + const componentView = getComponentLViewByIndex(hostTNode.index, hostView); return new ViewRef(componentView, null, componentIndex); } else if ( hostTNode.type === TNodeType.Element || hostTNode.type === TNodeType.Container || @@ -406,6 +406,6 @@ export function injectRenderer2(): Renderer2 { // DI happens before we've entered its view, `getLView` will return the parent view instead. const lView = getLView(); const tNode = getPreviousOrParentTNode(); - const nodeAtIndex = getComponentViewByIndex(tNode.index, lView); + const nodeAtIndex = getComponentLViewByIndex(tNode.index, lView); return getOrCreateRenderer2(isLView(nodeAtIndex) ? nodeAtIndex : lView); }