(shouldTrackSideEffects)
| 13570 | |
| 13571 | |
| 13572 | function ChildReconciler(shouldTrackSideEffects) { |
| 13573 | function deleteChild(returnFiber, childToDelete) { |
| 13574 | if (!shouldTrackSideEffects) { |
| 13575 | // Noop. |
| 13576 | return; |
| 13577 | } // Deletions are added in reversed order so we add it to the front. |
| 13578 | // At this point, the return fiber's effect list is empty except for |
| 13579 | // deletions, so we can just append the deletion to the list. The remaining |
| 13580 | // effects aren't added until the complete phase. Once we implement |
| 13581 | // resuming, this may not be true. |
| 13582 | |
| 13583 | |
| 13584 | var last = returnFiber.lastEffect; |
| 13585 | |
| 13586 | if (last !== null) { |
| 13587 | last.nextEffect = childToDelete; |
| 13588 | returnFiber.lastEffect = childToDelete; |
| 13589 | } else { |
| 13590 | returnFiber.firstEffect = returnFiber.lastEffect = childToDelete; |
| 13591 | } |
| 13592 | |
| 13593 | childToDelete.nextEffect = null; |
| 13594 | childToDelete.effectTag = Deletion; |
| 13595 | } |
| 13596 | |
| 13597 | function deleteRemainingChildren(returnFiber, currentFirstChild) { |
| 13598 | if (!shouldTrackSideEffects) { |
| 13599 | // Noop. |
| 13600 | return null; |
| 13601 | } // TODO: For the shouldClone case, this could be micro-optimized a bit by |
| 13602 | // assuming that after the first child we've already added everything. |
| 13603 | |
| 13604 | |
| 13605 | var childToDelete = currentFirstChild; |
| 13606 | |
| 13607 | while (childToDelete !== null) { |
| 13608 | deleteChild(returnFiber, childToDelete); |
| 13609 | childToDelete = childToDelete.sibling; |
| 13610 | } |
| 13611 | |
| 13612 | return null; |
| 13613 | } |
| 13614 | |
| 13615 | function mapRemainingChildren(returnFiber, currentFirstChild) { |
| 13616 | // Add the remaining children to a temporary map so that we can find them by |
| 13617 | // keys quickly. Implicit (null) keys get added to this set with their index |
| 13618 | // instead. |
| 13619 | var existingChildren = new Map(); |
| 13620 | var existingChild = currentFirstChild; |
| 13621 | |
| 13622 | while (existingChild !== null) { |
| 13623 | if (existingChild.key !== null) { |
| 13624 | existingChildren.set(existingChild.key, existingChild); |
| 13625 | } else { |
| 13626 | existingChildren.set(existingChild.index, existingChild); |
| 13627 | } |
| 13628 | |
| 13629 | existingChild = existingChild.sibling; |
no outgoing calls
no test coverage detected