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
ed35adbea6
commit
15fa4bbdaf
@ -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
|
* Finds the index of the parent injector, with a view offset if applicable. Used to set the
|
||||||
* parent injector initially.
|
* 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 {
|
export function getParentInjectorLocation(tNode: TNode, lView: LView): RelativeInjectorLocation {
|
||||||
if (tNode.parent && tNode.parent.injectorIndex !== -1) {
|
if (tNode.parent && tNode.parent.injectorIndex !== -1) {
|
||||||
@ -227,8 +228,9 @@ export function getParentInjectorLocation(tNode: TNode, lView: LView): RelativeI
|
|||||||
const tView = lViewCursor[TVIEW];
|
const tView = lViewCursor[TVIEW];
|
||||||
const tViewType = tView.type;
|
const tViewType = tView.type;
|
||||||
if (tViewType === TViewType.Embedded) {
|
if (tViewType === TViewType.Embedded) {
|
||||||
ngDevMode && assertDefined(tView.node, 'Embedded TNodes should have declaration parents.');
|
ngDevMode &&
|
||||||
parentTNode = tView.node;
|
assertDefined(tView.declTNode, 'Embedded TNodes should have declaration parents.');
|
||||||
|
parentTNode = tView.declTNode;
|
||||||
} else if (tViewType === TViewType.Component) {
|
} else if (tViewType === TViewType.Component) {
|
||||||
// Components don't have `TView.declTNode` because each instance of component could be
|
// Components don't have `TView.declTNode` because each instance of component could be
|
||||||
// inserted in different location, hence `TView.declTNode` is meaningless.
|
// 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;
|
return NO_PARENT_INJECTOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes a type or an injection token public to the DI system by adding it to an
|
* Makes a type or an injection token public to the DI system by adding it to an
|
||||||
* injector's bloom filter.
|
* injector's bloom filter.
|
||||||
|
@ -120,7 +120,7 @@ export const TViewConstructor = class TView implements ITView {
|
|||||||
public template: ComponentTemplate<{}>|null, //
|
public template: ComponentTemplate<{}>|null, //
|
||||||
public queries: TQueries|null, //
|
public queries: TQueries|null, //
|
||||||
public viewQuery: ViewQueriesFunction<{}>|null, //
|
public viewQuery: ViewQueriesFunction<{}>|null, //
|
||||||
public node: ITNode|null, //
|
public declTNode: ITNode|null, //
|
||||||
public data: TData, //
|
public data: TData, //
|
||||||
public bindingStartIndex: number, //
|
public bindingStartIndex: number, //
|
||||||
public expandoStartIndex: number, //
|
public expandoStartIndex: number, //
|
||||||
|
@ -179,7 +179,7 @@ export function createLView<T>(
|
|||||||
lView[HOST] = host;
|
lView[HOST] = host;
|
||||||
lView[FLAGS] = flags | LViewFlags.CreationMode | LViewFlags.Attached | LViewFlags.FirstLViewPass;
|
lView[FLAGS] = flags | LViewFlags.CreationMode | LViewFlags.Attached | LViewFlags.FirstLViewPass;
|
||||||
resetPreOrderHookFlags(lView);
|
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[PARENT] = lView[DECLARATION_VIEW] = parentLView;
|
||||||
lView[CONTEXT] = context;
|
lView[CONTEXT] = context;
|
||||||
lView[RENDERER_FACTORY] = (rendererFactory || parentLView && parentLView[RENDERER_FACTORY])!;
|
lView[RENDERER_FACTORY] = (rendererFactory || parentLView && parentLView[RENDERER_FACTORY])!;
|
||||||
@ -682,7 +682,7 @@ export function createTView(
|
|||||||
template: templateFn,
|
template: templateFn,
|
||||||
queries: null,
|
queries: null,
|
||||||
viewQuery: viewQuery,
|
viewQuery: viewQuery,
|
||||||
node: declTNode,
|
declTNode: declTNode,
|
||||||
data: blueprint.slice().fill(null, bindingStartIndex),
|
data: blueprint.slice().fill(null, bindingStartIndex),
|
||||||
bindingStartIndex: bindingStartIndex,
|
bindingStartIndex: bindingStartIndex,
|
||||||
expandoStartIndex: initialViewLength,
|
expandoStartIndex: initialViewLength,
|
||||||
|
@ -499,8 +499,7 @@ export interface TView {
|
|||||||
/**
|
/**
|
||||||
* A `TNode` representing the declaration location of this `TView` (not part of this TView).
|
* A `TNode` representing the declaration location of this `TView` (not part of this TView).
|
||||||
*/
|
*/
|
||||||
// FIXME(misko): Rename `node` to `declTNode`
|
declTNode: TNode|null;
|
||||||
node: TNode|null;
|
|
||||||
|
|
||||||
// FIXME(misko): Why does `TView` not have `declarationTView` property?
|
// 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 embeddedTView = this._declarationTContainer.tViews as TView;
|
||||||
const embeddedLView = createLView(
|
const embeddedLView = createLView(
|
||||||
this._declarationView, embeddedTView, context, LViewFlags.CheckAlways, null,
|
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];
|
const declarationLContainer = this._declarationView[this._declarationTContainer.index];
|
||||||
ngDevMode && assertLContainer(declarationLContainer);
|
ngDevMode && assertLContainer(declarationLContainer);
|
||||||
|
@ -94,7 +94,7 @@ const ShapeOfTView: ShapeOf<TView> = {
|
|||||||
blueprint: true,
|
blueprint: true,
|
||||||
template: true,
|
template: true,
|
||||||
viewQuery: true,
|
viewQuery: true,
|
||||||
node: true,
|
declTNode: true,
|
||||||
firstCreatePass: true,
|
firstCreatePass: true,
|
||||||
firstUpdatePass: true,
|
firstUpdatePass: true,
|
||||||
data: true,
|
data: true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user