refactor(ivy): replace LNode.dynamicLContainerNode with flat LContainers (#26407)

PR Close #26407
This commit is contained in:
Kara Erickson
2018-10-11 13:13:57 -07:00
committed by Miško Hevery
parent 70cd112872
commit 735dfd3b1a
14 changed files with 330 additions and 199 deletions

View File

@ -10,11 +10,12 @@ import {devModeEqual} from '../change_detection/change_detection_util';
import {assertDefined, assertLessThan} from './assert';
import {readElementValue, readPatchedLViewData} from './context_discovery';
import {LContainerNode, LElementContainerNode, LElementNode, TNode, TNodeFlags} from './interfaces/node';
import {ACTIVE_INDEX, LContainer} from './interfaces/container';
import {LContainerNode, LElementContainerNode, LElementNode, LNode, TNode, TNodeFlags} from './interfaces/node';
import {StylingContext} from './interfaces/styling';
import {CONTEXT, FLAGS, HEADER_OFFSET, LViewData, LViewFlags, PARENT, RootContext, TData, TVIEW} from './interfaces/view';
/**
* Returns whether the values are different from a change detection stand point.
*
@ -103,6 +104,12 @@ export function isContentQueryHost(tNode: TNode): boolean {
export function isComponent(tNode: TNode): boolean {
return (tNode.flags & TNodeFlags.isComponent) === TNodeFlags.isComponent;
}
export function isLContainer(value: LNode | LContainer | StylingContext): boolean {
// Styling contexts are also arrays, but their first index contains an element node
return Array.isArray(value) && typeof value[ACTIVE_INDEX] === 'number';
}
/**
* Retrieve the root view from any component by walking the parent `LViewData` until
* reaching the root `LViewData`.