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

Method readsOnly

ark/aot/graph.ts:5643–5662  ·  view source on GitHub ↗
(callee: Node, module: SourceModule)

Source from the content-addressed store, hash-verified

5641
5642 // a global reading what it's passed, holding none of it after
5643 private readsOnly(callee: Node, module: SourceModule): boolean {
5644 callee = unwrapChain(callee)
5645 if (callee.type === "Identifier") {
5646 return (
5647 !module.scopes.byId.get(callee)?.binding &&
5648 callee.name in readingGlobals
5649 )
5650 }
5651 if (
5652 callee.type !== "MemberExpression" ||
5653 callee.object.type !== "Identifier" ||
5654 module.scopes.byId.get(callee.object)?.binding
5655 )
5656 return false
5657 const name = memberNameOf(callee)
5658 return (
5659 typeof name === "string" &&
5660 !!readingMembersByGlobal[callee.object.name]?.includes(name)
5661 )
5662 }
5663
5664 isEscape(write: Node): boolean {
5665 return this.escapes.has(write)

Callers 2

mayWriteInCallbackMethod · 0.95
mayWriteFromMethod · 0.95

Calls 3

unwrapChainFunction · 0.90
memberNameOfFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected