mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Make SchedulerMinHeap flow strict (#16351)
@acdlite while browsing Twitter, I saw [an opportunity][1] to do something more productive than browsing Twitter. [1]: https://twitter.com/acdlite/status/1160247965908234240 Test plan: `yarn flow-ci`, `yarn test-prod`, `yarn lint`
This commit is contained in:
committed by
Andrew Clark
parent
e349da19b8
commit
7a7e792a6f
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow
|
||||
* @flow strict
|
||||
*/
|
||||
|
||||
type Heap = Array<Node>;
|
||||
@@ -38,7 +38,8 @@ export function pop(heap: Heap): Node | null {
|
||||
}
|
||||
}
|
||||
|
||||
function siftUp(heap, node, index) {
|
||||
function siftUp(heap, node, i) {
|
||||
let index = i;
|
||||
while (true) {
|
||||
const parentIndex = Math.floor((index - 1) / 2);
|
||||
const parent = heap[parentIndex];
|
||||
@@ -54,7 +55,8 @@ function siftUp(heap, node, index) {
|
||||
}
|
||||
}
|
||||
|
||||
function siftDown(heap, node, index) {
|
||||
function siftDown(heap, node, i) {
|
||||
let index = i;
|
||||
const length = heap.length;
|
||||
while (index < length) {
|
||||
const leftIndex = (index + 1) * 2 - 1;
|
||||
|
||||
Reference in New Issue
Block a user