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

Function isOwnReadUse

ark/aot/usage.ts:2627–2651  ·  view source on GitHub ↗
(read: Node, use: Node | undefined)

Source from the content-addressed store, hash-verified

2625 }
2626 }
2627 const isOwnReadUse = (read: Node, use: Node | undefined): boolean => {
2628 if (
2629 use?.type === "MemberExpression" &&
2630 use.object === read &&
2631 !isWriteTarget(use)
2632 ) {
2633 const name = memberNameOf(use)
2634 if (typeof name !== "string" || !ownKeys.has(name)) return false
2635 if (isDirectCallMember(use))
2636 return inlineFnKeys.has(name) || name === allowedCallKey
2637 return true
2638 }
2639 if (
2640 use?.type === "VariableDeclarator" &&
2641 use.init === read &&
2642 use.id.type === "ObjectPattern"
2643 ) {
2644 return use.id.properties.every(property => {
2645 if (property.type !== "Property") return false
2646 const key = propertyKeyOf(property)
2647 return key !== undefined && ownKeys.has(key)
2648 })
2649 }
2650 return false
2651 }
2652 const [operand, parent] = operatorOf(literal)
2653 if (
2654 parent?.type === "VariableDeclarator" &&

Callers 1

receivesNoEscapedThisFunction · 0.85

Calls 5

isWriteTargetFunction · 0.90
memberNameOfFunction · 0.90
propertyKeyOfFunction · 0.90
isDirectCallMemberFunction · 0.85
hasMethod · 0.45

Tested by

no test coverage detected