refactor(core): Rename `TView.node` to `TView.declTNode`. (#38707)
The value stored in `TView.node` is really the declaration `TNode`, therefore renaming to make it more explicit. PR Close #38707
This commit is contained in:
parent
5db84d7221
commit
5a86fb33ba
|
@ -203,7 +203,8 @@ export function getInjectorIndex(tNode: TNode, lView: LView): number {
|
|||
* Finds the index of the parent injector, with a view offset if applicable. Used to set the
|
||||
* parent injector initially.
|
||||
*
|
||||
* Returns a combination of number of `LView` we have to go up and index in that `LView`
|
||||
* @returns Returns a number that is the combination of the number of LViews that we have to go up
|
||||
* to find the LView containing the parent inject AND the index of the injector within that LView.
|
||||
*/
|
||||
export function getParentInjectorLocation(tNode: TNode, lView: LView): RelativeInjectorLocation {
|
||||
if (tNode.parent && tNode.parent.injectorIndex !== -1) {
|
||||
|
@ -227,8 +228,9 @@ export function getParentInjectorLocation(tNode: TNode, lView: LView): RelativeI
|
|||
const tView = lViewCursor[TVIEW];
|
||||
const tViewType = tView.type;
|
||||
if (tViewType === TViewType.Embedded) {
|
||||
ngDevMode && assertDefined(tView.node, 'Embedded TNodes should have declaration parents.');
|
||||
parentTNode = tView.node;
|
||||
ngDevMode &&
|
||||
assertDefined(tView.declTNode, 'Embedded TNodes should have declaration parents.');
|
||||
parentTNode = tView.declTNode;
|
||||
} else if (tViewType === TViewType.Component) {
|
||||
// Components don't have `TView.declTNode` because each instance of component could be
|
||||
// inserted in different location, hence `TView.declTNode` is meaningless.
|
||||
|
@ -255,7 +257,6 @@ export function getParentInjectorLocation(tNode: TNode, lView: LView): RelativeI
|
|||
}
|
||||
return NO_PARENT_INJECTOR;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a type or an injection token public to the DI system by adding it to an
|
||||
* injector's bloom filter.
|
||||
|
|
|
@ -120,7 +120,7 @@ export const TViewConstructor = class TView implements ITView {
|
|||
public template: ComponentTemplate<{}>|null, //
|
||||
public queries: TQueries|null, //
|
||||
public viewQuery: ViewQueriesFunction<{}>|null, //
|
||||
public node: ITNode|null, //
|
||||
public declTNode: ITNode|null, //
|
||||
public data: TData, //
|
||||
public bindingStartIndex: number, //
|
||||
public expandoStartIndex: number, //
|
||||
|
|
|
@ -179,7 +179,7 @@ export function createLView<T>(
|
|||
lView[HOST] = host;
|
||||
lView[FLAGS] = flags | LViewFlags.CreationMode | LViewFlags.Attached | LViewFlags.FirstLViewPass;
|
||||
resetPreOrderHookFlags(lView);
|
||||
ngDevMode && tView.node && parentLView && assertTNodeForLView(tView.node, parentLView);
|
||||
ngDevMode && tView.declTNode && parentLView && assertTNodeForLView(tView.declTNode, parentLView);
|
||||
lView[PARENT] = lView[DECLARATION_VIEW] = parentLView;
|
||||
lView[CONTEXT] = context;
|
||||
lView[RENDERER_FACTORY] = (rendererFactory || parentLView && parentLView[RENDERER_FACTORY])!;
|
||||
|
@ -682,7 +682,7 @@ export function createTView(
|
|||
template: templateFn,
|
||||
queries: null,
|
||||
viewQuery: viewQuery,
|
||||
node: declTNode,
|
||||
declTNode: declTNode,
|
||||
data: blueprint.slice().fill(null, bindingStartIndex),
|
||||
bindingStartIndex: bindingStartIndex,
|
||||
expandoStartIndex: initialViewLength,
|
||||
|
|
|
@ -499,8 +499,7 @@ export interface TView {
|
|||
/**
|
||||
* A `TNode` representing the declaration location of this `TView` (not part of this TView).
|
||||
*/
|
||||
// FIXME(misko): Rename `node` to `declTNode`
|
||||
node: TNode|null;
|
||||
declTNode: TNode|null;
|
||||
|
||||
// FIXME(misko): Why does `TView` not have `declarationTView` property?
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ export function createTemplateRef<T>(
|
|||
const embeddedTView = this._declarationTContainer.tViews as TView;
|
||||
const embeddedLView = createLView(
|
||||
this._declarationView, embeddedTView, context, LViewFlags.CheckAlways, null,
|
||||
embeddedTView.node, null, null, null, null);
|
||||
embeddedTView.declTNode, null, null, null, null);
|
||||
|
||||
const declarationLContainer = this._declarationView[this._declarationTContainer.index];
|
||||
ngDevMode && assertLContainer(declarationLContainer);
|
||||
|
|
|
@ -94,7 +94,7 @@ const ShapeOfTView: ShapeOf<TView> = {
|
|||
blueprint: true,
|
||||
template: true,
|
||||
viewQuery: true,
|
||||
node: true,
|
||||
declTNode: true,
|
||||
firstCreatePass: true,
|
||||
firstUpdatePass: true,
|
||||
data: true,
|
||||
|
|
Loading…
Reference in New Issue