refactor(ivy): remove superflous argument to the createTNodeAtIndex function (#32370)

PR Close #32370
This commit is contained in:
Pawel Kozlowski 2019-08-28 15:17:26 +02:00 committed by Miško Hevery
parent 97fc45f32a
commit 1bb9ce5d8c
1 changed files with 6 additions and 5 deletions

View File

@ -212,7 +212,7 @@ export function getOrCreateTNode(
// Keep this function short, so that the VM will inline it. // Keep this function short, so that the VM will inline it.
const adjustedIndex = index + HEADER_OFFSET; const adjustedIndex = index + HEADER_OFFSET;
const tNode = tView.data[adjustedIndex] as TNode || const tNode = tView.data[adjustedIndex] as TNode ||
createTNodeAtIndex(tView, tHostNode, adjustedIndex, type, name, attrs, index); createTNodeAtIndex(tView, tHostNode, adjustedIndex, type, name, attrs);
setPreviousOrParentTNode(tNode, true); setPreviousOrParentTNode(tNode, true);
return tNode as TElementNode & TViewNode & TContainerNode & TElementContainerNode & return tNode as TElementNode & TViewNode & TContainerNode & TElementContainerNode &
TProjectionNode & TIcuContainerNode; TProjectionNode & TIcuContainerNode;
@ -220,7 +220,7 @@ export function getOrCreateTNode(
function createTNodeAtIndex( function createTNodeAtIndex(
tView: TView, tHostNode: TNode | null, adjustedIndex: number, type: TNodeType, tView: TView, tHostNode: TNode | null, adjustedIndex: number, type: TNodeType,
name: string | null, attrs: TAttributes | null, index: number) { name: string | null, attrs: TAttributes | null) {
const previousOrParentTNode = getPreviousOrParentTNode(); const previousOrParentTNode = getPreviousOrParentTNode();
const isParent = getIsParent(); const isParent = getIsParent();
const parent = const parent =
@ -231,9 +231,10 @@ function createTNodeAtIndex(
const tParentNode = parentInSameView ? parent as TElementNode | TContainerNode : null; const tParentNode = parentInSameView ? parent as TElementNode | TContainerNode : null;
const tNode = tView.data[adjustedIndex] = const tNode = tView.data[adjustedIndex] =
createTNode(tView, tParentNode, type, adjustedIndex, name, attrs); createTNode(tView, tParentNode, type, adjustedIndex, name, attrs);
// The first node is not always the one at index 0, in case of i18n, index 0 can be the // Assign a pointer to the first child node of a given view. The first node is not always the one
// instruction `i18nStart` and the first node has the index 1 or more // at index 0, in case of i18n, index 0 can be the instruction `i18nStart` and the first node has
if (index === 0 || !tView.firstChild) { // the index 1 or more, so we can't just check node index.
if (tView.firstChild === null) {
tView.firstChild = tNode; tView.firstChild = tNode;
} }
if (previousOrParentTNode) { if (previousOrParentTNode) {