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

Function instanceExposesComputed

ark/aot/usage.ts:1839–1873  ·  view source on GitHub ↗
(
	newExpr: Node,
	module: SourceModule
)

Source from the content-addressed store, hash-verified

1837}
1838
1839const instanceExposesComputed = (
1840 newExpr: Node,
1841 module: SourceModule
1842): boolean => {
1843 const [op, parent] = operatorOf(newExpr)
1844 if (
1845 parent?.type === "MemberExpression" &&
1846 parent.object === op &&
1847 !isWriteTarget(parent) &&
1848 staticMemberKeyOf(parent, module) === undefined &&
1849 !isDirectCallMember(parent)
1850 )
1851 return true
1852 if (
1853 parent?.type === "VariableDeclarator" &&
1854 parent.init === op &&
1855 parent.id.type === "Identifier"
1856 ) {
1857 const binding = module.scopes.bindingsById.get(parent.id)
1858 if (!binding) return true
1859 for (const ref of binding.references) {
1860 if (ref.isWrite) continue
1861 const [refOp, refUse] = operatorOf(ref.id)
1862 if (
1863 refUse?.type === "MemberExpression" &&
1864 refUse.object === refOp &&
1865 !isWriteTarget(refUse) &&
1866 staticMemberKeyOf(refUse, module) === undefined &&
1867 !isDirectCallMember(refUse)
1868 )
1869 return true
1870 }
1871 }
1872 return false
1873}
1874
1875const classExposesMembers = (
1876 cls: Extract<Node, { type: "ClassDeclaration" | "ClassExpression" }>,

Callers 2

classBindingExposesFunction · 0.85
ctorExposesPrototypeFunction · 0.85

Calls 5

operatorOfFunction · 0.90
isWriteTargetFunction · 0.90
staticMemberKeyOfFunction · 0.85
isDirectCallMemberFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected