()
| 67 | }; |
| 68 | |
| 69 | function getPrimitiveStackCache(): Map<string, Array<any>> { |
| 70 | // This initializes a cache of all primitive hooks so that the top |
| 71 | // most stack frames added by calling the primitive hook can be removed. |
| 72 | if (primitiveStackCache === null) { |
| 73 | const cache = new Map<string, Array<any>>(); |
| 74 | let readHookLog; |
| 75 | try { |
| 76 | // Use all hooks here to add them to the hook log. |
| 77 | Dispatcher.useContext(({_currentValue: null}: any)); |
| 78 | Dispatcher.useState(null); |
| 79 | Dispatcher.useReducer((s: mixed, a: mixed) => s, null); |
| 80 | Dispatcher.useRef(null); |
| 81 | if (typeof Dispatcher.useCacheRefresh === 'function') { |
| 82 | // This type check is for Flow only. |
| 83 | Dispatcher.useCacheRefresh(); |
| 84 | } |
| 85 | Dispatcher.useLayoutEffect(() => {}); |
| 86 | Dispatcher.useInsertionEffect(() => {}); |
| 87 | Dispatcher.useEffect(() => {}); |
| 88 | Dispatcher.useImperativeHandle(undefined, () => null); |
| 89 | Dispatcher.useDebugValue(null); |
| 90 | Dispatcher.useCallback(() => {}); |
| 91 | Dispatcher.useTransition(); |
| 92 | Dispatcher.useSyncExternalStore( |
| 93 | () => () => {}, |
| 94 | () => null, |
| 95 | () => null, |
| 96 | ); |
| 97 | Dispatcher.useDeferredValue(null); |
| 98 | Dispatcher.useMemo(() => null); |
| 99 | Dispatcher.useOptimistic(null, (s: mixed, a: mixed) => s); |
| 100 | Dispatcher.useFormState((s: mixed, p: mixed) => s, null); |
| 101 | Dispatcher.useActionState((s: mixed, p: mixed) => s, null); |
| 102 | Dispatcher.useHostTransitionStatus(); |
| 103 | if (typeof Dispatcher.useMemoCache === 'function') { |
| 104 | // This type check is for Flow only. |
| 105 | Dispatcher.useMemoCache(0); |
| 106 | } |
| 107 | if (typeof Dispatcher.use === 'function') { |
| 108 | // This type check is for Flow only. |
| 109 | Dispatcher.use( |
| 110 | ({ |
| 111 | $$typeof: REACT_CONTEXT_TYPE, |
| 112 | _currentValue: null, |
| 113 | }: any), |
| 114 | ); |
| 115 | Dispatcher.use({ |
| 116 | then() {}, |
| 117 | status: 'fulfilled', |
| 118 | value: null, |
| 119 | }); |
| 120 | try { |
| 121 | Dispatcher.use( |
| 122 | ({ |
| 123 | then() {}, |
| 124 | }: any), |
| 125 | ); |
| 126 | } catch (x) {} |
no test coverage detected