refactor(ivy): add tNodes for view nodes and hosts (#24113)

PR Close #24113
This commit is contained in:
Kara Erickson
2018-05-16 05:56:01 -07:00
committed by Matias Niemelä
parent 13cb75da8b
commit 8216657681
10 changed files with 92 additions and 51 deletions

View File

@ -118,11 +118,12 @@ export interface LNode {
* Pointer to the corresponding TNode object, which stores static
* data about this node.
*/
tNode: TNode|null;
tNode: TNode;
/**
* A pointer to a LContainerNode created by directives requesting ViewContainerRef
*/
// TODO(kara): Remove when removing LNodes
dynamicLContainerNode: LContainerNode|null;
}
@ -210,8 +211,10 @@ export interface TNode {
*
* This is necessary to get from any TNode to its corresponding LNode when
* traversing the node tree.
*
* If null, this is a view node created from a dynamically created view.
*/
index: number;
index: number|null;
/**
* This number stores two values using its bits:
@ -306,6 +309,11 @@ export interface TNode {
* to insert them or remove them from the DOM.
*/
next: TNode|null;
/**
* A pointer to a LContainerNode created by directives requesting ViewContainerRef
*/
dynamicContainerNode: TNode|null;
}
/** Static data for an LElementNode */

View File

@ -46,6 +46,7 @@ export interface LView {
*
* If `LElementNode`, this is the LView of a component.
*/
// TODO(kara): Remove when we have parent/child on TNodes
readonly node: LViewNode|LElementNode;
/**
@ -241,6 +242,17 @@ export interface LViewOrLContainer {
* Stored on the template function as ngPrivateData.
*/
export interface TView {
/**
* Pointer to the `TNode` that represents the root of the view.
*
* If this is a `TNode` for an `LViewNode`, this is an embedded view of a container.
* We need this pointer to be able to efficiently find this node when inserting the view
* into an anchor.
*
* If this is a `TNode` for an `LElementNode`, this is the TView of a component.
*/
node: TNode;
/** Whether or not this template has been processed. */
firstTemplatePass: boolean;