( edit: number, shift: number, h1: number, n1: Node<K, V>, h2: number, n2: Node<K, V> )
| 363 | } |
| 364 | |
| 365 | function mergeLeaves<K, V>( |
| 366 | edit: number, |
| 367 | shift: number, |
| 368 | h1: number, |
| 369 | n1: Node<K, V>, |
| 370 | h2: number, |
| 371 | n2: Node<K, V> |
| 372 | ): Node<K, V> { |
| 373 | let stack: Stack.Stack<(node: Node<K, V>) => Node<K, V>> | undefined = undefined |
| 374 | let currentShift = shift |
| 375 | |
| 376 | while (true) { |
| 377 | const res = mergeLeavesInner(edit, currentShift, h1, n1, h2, n2) |
| 378 | |
| 379 | if (typeof res === "function") { |
| 380 | stack = Stack.make(res, stack) |
| 381 | currentShift = currentShift + SIZE |
| 382 | } else { |
| 383 | let final = res |
| 384 | while (stack != null) { |
| 385 | final = stack.value(final) |
| 386 | stack = stack.previous |
| 387 | } |
| 388 | return final |
| 389 | } |
| 390 | } |
| 391 | } |
no test coverage detected