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

Function bindingOfFunction

ark/aot/graph.ts:7498–7511  ·  view source on GitHub ↗
(
	node: Node,
	module: SourceModule
)

Source from the content-addressed store, hash-verified

7496 importsValues(module)
7497
7498export const bindingOfFunction = (
7499 node: Node,
7500 module: SourceModule
7501): Binding | undefined => {
7502 if (node.parent && namedFunctionOf(node.parent, module) === node)
7503 node = node.parent
7504 const id =
7505 node.type === "FunctionDeclaration" || node.type === "ClassDeclaration" ?
7506 node.id
7507 : node.parent?.type === "VariableDeclarator" && node.parent.init === node ?
7508 node.parent.id
7509 : undefined
7510 return id ? module.scopes.bindingsById.get(id) : undefined
7511}
7512
7513export const enclosingFunctionOf = (node: Node): FunctionNode | undefined => {
7514 for (let parent = node.parent; parent; parent = parent.parent)

Callers 9

nameOfMethod · 0.90
runPointOfFunction · 0.90
isUsedAtLoadFunction · 0.90
callersOfFunction · 0.90
calledParamOfMethod · 0.90
buildPerturbedFunction · 0.90
callsOfMethod · 0.85
returnReachesUnseenMethod · 0.85
isCallableBeforeBodyFunction · 0.85

Calls 2

namedFunctionOfFunction · 0.85
getMethod · 0.65

Tested by 1

buildPerturbedFunction · 0.72