( workInProgress: Fiber, Component: Function, didPushOwnContextIfProvider: boolean, )
| 38 | let previousContext: Object = emptyContextObject; |
| 39 | |
| 40 | function getUnmaskedContext( |
| 41 | workInProgress: Fiber, |
| 42 | Component: Function, |
| 43 | didPushOwnContextIfProvider: boolean, |
| 44 | ): Object { |
| 45 | if (disableLegacyContext) { |
| 46 | return emptyContextObject; |
| 47 | } else { |
| 48 | if (didPushOwnContextIfProvider && isContextProvider(Component)) { |
| 49 | // If the fiber is a context provider itself, when we read its context |
| 50 | // we may have already pushed its own child context on the stack. A context |
| 51 | // provider should not "see" its own child context. Therefore we read the |
| 52 | // previous (parent) context instead for a context provider. |
| 53 | return previousContext; |
| 54 | } |
| 55 | return contextStackCursor.current; |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | function cacheContext( |
| 60 | workInProgress: Fiber, |
no test coverage detected