( root: BaseRoot, mutatesInput: MutatesInput | undefined )
| 321 | |
| 322 | /** whether a valid input's transforms write into it */ |
| 323 | export const writesInPlace = ( |
| 324 | root: BaseRoot, |
| 325 | mutatesInput: MutatesInput | undefined |
| 326 | ): boolean => { |
| 327 | if (!mutatesInput || !root.tfs) return false |
| 328 | const cache = writesInPlaceByMode[mutatesInput === true ? "true" : "always"] |
| 329 | let writes = cache.get(root) |
| 330 | if (writes === undefined) { |
| 331 | const places = placesOf(root) |
| 332 | writes = |
| 333 | holdsWriter(places) && |
| 334 | writesSoundly(places) && |
| 335 | (mutatesInput !== true || |
| 336 | (!passesContext(places) && writesUnread(places))) |
| 337 | cache.set(root, writes) |
| 338 | } |
| 339 | return writes |
| 340 | } |
| 341 | |
| 342 | const inPlaceRuntimes = new WeakMap<RootApplyRuntime, RootApplyRuntime>() |
| 343 |
no test coverage detected