()
| 147 | |
| 148 | // discovering objects as it reads them, so changes hold each reachable one |
| 149 | const changesSinceLastStep = (): Changes => { |
| 150 | const changes: Changes = [] |
| 151 | // its result is only printed where it stops arktype's write |
| 152 | if (printsResults) return changes |
| 153 | for (let id = 0; id < objects.length; id++) { |
| 154 | if (++reads > maxTracedReads) { |
| 155 | tooDeep.add(root) |
| 156 | refuseReplay() |
| 157 | } |
| 158 | const o = objects[id] as Record<string, unknown> |
| 159 | const keys = Object.keys(o) |
| 160 | if (isUnchanged(keys, o, keysRead[id], valuesRead[id])) continue |
| 161 | const values = keys.map(key => o[key]) |
| 162 | keysRead[id] = keys |
| 163 | valuesRead[id] = values |
| 164 | states[id] = keys.map((key, i) => { |
| 165 | const spread = markers.get(key) |
| 166 | return spread === undefined ? |
| 167 | { key, ref: refOf(values[i]) } |
| 168 | : { spread } |
| 169 | }) |
| 170 | changes.push([id, states[id]]) |
| 171 | } |
| 172 | return changes |
| 173 | } |
| 174 | |
| 175 | const unwritten = () => { |
| 176 | const hole = copies.length |
no test coverage detected