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

Function classBindingExposes

ark/aot/usage.ts:1897–1946  ·  view source on GitHub ↗
(
	binding: Binding,
	module: SourceModule,
	ctx: ThisReadsContext,
	seenBindings: Set<Binding>,
	seenExports: Set<string>
)

Source from the content-addressed store, hash-verified

1895}
1896
1897const classBindingExposes = (
1898 binding: Binding,
1899 module: SourceModule,
1900 ctx: ThisReadsContext,
1901 seenBindings: Set<Binding>,
1902 seenExports: Set<string>
1903): boolean => {
1904 if (seenBindings.has(binding)) return false
1905 seenBindings.add(binding)
1906 if (binding.writes.length > 0) return true
1907 for (const ref of binding.references) {
1908 if (ref.isWrite) return true
1909 const [op, use] = operatorOf(ref.id)
1910 if (
1911 use?.type === "ExportSpecifier" ||
1912 (use?.type === "ExportDefaultDeclaration" && use.declaration === op)
1913 )
1914 continue
1915 if (use?.type === "NewExpression" && use.callee === op) {
1916 if (instanceExposesComputed(use, module)) return true
1917 continue
1918 }
1919 if (
1920 (use?.type === "ClassDeclaration" || use?.type === "ClassExpression") &&
1921 use.superClass === op
1922 ) {
1923 if (classExposesMembers(use, module, ctx)) return true
1924 continue
1925 }
1926 if (
1927 use?.type === "BinaryExpression" &&
1928 (use.operator === "instanceof" || isEqualityOperator(use.operator))
1929 )
1930 continue
1931 if (use?.type === "MemberExpression" && use.object === op) {
1932 if (isWriteTarget(use)) return true
1933 const name = staticMemberKeyOf(use, module)
1934 if (name === "prototype") return true
1935 if (name === undefined && !isDirectCallMember(use)) return true
1936 continue
1937 }
1938 if (isNonCallingFunctionRead(op, use, module)) continue
1939 return true
1940 }
1941 for (const exportName of binding.exportNames) {
1942 if (classExportExposes(module, exportName, ctx, seenBindings, seenExports))
1943 return true
1944 }
1945 return false
1946}
1947
1948const classExportExposes = (
1949 module: SourceModule,

Callers 2

classExposesMembersFunction · 0.85
classExportExposesFunction · 0.85

Calls 11

operatorOfFunction · 0.90
isWriteTargetFunction · 0.90
instanceExposesComputedFunction · 0.85
classExposesMembersFunction · 0.85
isEqualityOperatorFunction · 0.85
staticMemberKeyOfFunction · 0.85
isDirectCallMemberFunction · 0.85
isNonCallingFunctionReadFunction · 0.85
classExportExposesFunction · 0.85
hasMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected