MCPcopy Create free account
hub / github.com/arktypeio/arktype / writesInPlace

Function writesInPlace

ark/schema/shared/inPlace.ts:323–340  ·  view source on GitHub ↗
(
	root: BaseRoot,
	mutatesInput: MutatesInput | undefined
)

Source from the content-addressed store, hash-verified

321
322/** whether a valid input's transforms write into it */
323export 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
342const inPlaceRuntimes = new WeakMap<RootApplyRuntime, RootApplyRuntime>()
343

Callers 2

variantOfMethod · 0.85

Calls 7

placesOfFunction · 0.85
holdsWriterFunction · 0.85
writesSoundlyFunction · 0.85
passesContextFunction · 0.85
writesUnreadFunction · 0.85
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected