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

Function readsOnlyMembers

ark/aot/graph.ts:758–768  ·  view source on GitHub ↗
(binding: Binding)

Source from the content-addressed store, hash-verified

756// e.g. `store` read only as `store.add(...)` or `new Store()`, so nothing
757// can replace a member its instances run
758const readsOnlyMembers = (binding: Binding): boolean =>
759 !binding.writes.length &&
760 binding.references.every(reference => {
761 const [operand, parent] = operatorOf(reference.id)
762 return (
763 (parent?.type === "MemberExpression" &&
764 parent.object === operand &&
765 !isWriteTarget(parent)) ||
766 (parent?.type === "NewExpression" && parent.callee === operand)
767 )
768 })
769
770// e.g. `this.add = add` or `Object.assign(this, methods)`
771const replacesMember = (cls: Class, name: string): boolean => {

Callers 2

instanceMethodOfMethod · 0.85
instanceClassOfMethod · 0.85

Calls 2

operatorOfFunction · 0.90
isWriteTargetFunction · 0.90

Tested by

no test coverage detected