MCPcopy Index your code
hub / github.com/Effect-TS/effect / mergeLeaves

Function mergeLeaves

packages/effect/src/internal/hashMap/node.ts:365–391  ·  view source on GitHub ↗
(
  edit: number,
  shift: number,
  h1: number,
  n1: Node<K, V>,
  h2: number,
  n2: Node<K, V>
)

Source from the content-addressed store, hash-verified

363}
364
365function 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}

Callers 2

modifyMethod · 0.85
modifyMethod · 0.85

Calls 3

mergeLeavesInnerFunction · 0.85
makeMethod · 0.65
valueMethod · 0.45

Tested by

no test coverage detected