(workInProgress, context, changedBits, renderExpirationTime)
| 10477 | } |
| 10478 | |
| 10479 | function propagateContextChange(workInProgress, context, changedBits, renderExpirationTime) { |
| 10480 | var fiber = workInProgress.child; |
| 10481 | if (fiber !== null) { |
| 10482 | // Set the return pointer of the child to the work-in-progress fiber. |
| 10483 | fiber['return'] = workInProgress; |
| 10484 | } |
| 10485 | while (fiber !== null) { |
| 10486 | var nextFiber = void 0; |
| 10487 | // Visit this fiber. |
| 10488 | switch (fiber.tag) { |
| 10489 | case ContextConsumer: |
| 10490 | // Check if the context matches. |
| 10491 | var observedBits = fiber.stateNode | 0; |
| 10492 | if (fiber.type === context && (observedBits & changedBits) !== 0) { |
| 10493 | // Update the expiration time of all the ancestors, including |
| 10494 | // the alternates. |
| 10495 | var node = fiber; |
| 10496 | while (node !== null) { |
| 10497 | var alternate = node.alternate; |
| 10498 | if (node.expirationTime === NoWork || node.expirationTime > renderExpirationTime) { |
| 10499 | node.expirationTime = renderExpirationTime; |
| 10500 | if (alternate !== null && (alternate.expirationTime === NoWork || alternate.expirationTime > renderExpirationTime)) { |
| 10501 | alternate.expirationTime = renderExpirationTime; |
| 10502 | } |
| 10503 | } else if (alternate !== null && (alternate.expirationTime === NoWork || alternate.expirationTime > renderExpirationTime)) { |
| 10504 | alternate.expirationTime = renderExpirationTime; |
| 10505 | } else { |
| 10506 | // Neither alternate was updated, which means the rest of the |
| 10507 | // ancestor path already has sufficient priority. |
| 10508 | break; |
| 10509 | } |
| 10510 | node = node['return']; |
| 10511 | } |
| 10512 | // Don't scan deeper than a matching consumer. When we render the |
| 10513 | // consumer, we'll continue scanning from that point. This way the |
| 10514 | // scanning work is time-sliced. |
| 10515 | nextFiber = null; |
| 10516 | } else { |
| 10517 | // Traverse down. |
| 10518 | nextFiber = fiber.child; |
| 10519 | } |
| 10520 | break; |
| 10521 | case ContextProvider: |
| 10522 | // Don't scan deeper if this is a matching provider |
| 10523 | nextFiber = fiber.type === workInProgress.type ? null : fiber.child; |
| 10524 | break; |
| 10525 | default: |
| 10526 | // Traverse down. |
| 10527 | nextFiber = fiber.child; |
| 10528 | break; |
| 10529 | } |
| 10530 | if (nextFiber !== null) { |
| 10531 | // Set the return pointer of the child to the work-in-progress fiber. |
| 10532 | nextFiber['return'] = fiber; |
| 10533 | } else { |
| 10534 | // No child. Traverse to next sibling. |
| 10535 | nextFiber = fiber; |
| 10536 | while (nextFiber !== null) { |
no outgoing calls
no test coverage detected