| 108 | } |
| 109 | |
| 110 | class HashMapIterator<in out K, in out V, out T> implements IterableIterator<T> { |
| 111 | v: Option.Option<VisitResult<K, V, T>> |
| 112 | |
| 113 | constructor(readonly map: HashMapImpl<K, V>, readonly f: TraversalFn<K, V, T>) { |
| 114 | this.v = visitLazy(this.map._root, this.f, undefined) |
| 115 | } |
| 116 | |
| 117 | next(): IteratorResult<T> { |
| 118 | if (Option.isNone(this.v)) { |
| 119 | return { done: true, value: undefined } |
| 120 | } |
| 121 | const v0 = this.v.value |
| 122 | this.v = applyCont(v0.cont) |
| 123 | return { done: false, value: v0.value } |
| 124 | } |
| 125 | |
| 126 | [Symbol.iterator](): IterableIterator<T> { |
| 127 | return new HashMapIterator(this.map, this.f) |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | const applyCont = <K, V, A>(cont: Cont<K, V, A>): Option.Option<VisitResult<K, V, A>> => |
| 132 | cont |
nothing calls this directly
no outgoing calls
no test coverage detected