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

Method visitFunction

ark/aot/scope.ts:363–383  ·  view source on GitHub ↗
(node: Function | ArrowFunctionNode)

Source from the content-addressed store, hash-verified

361 }
362
363 private visitFunction(node: Function | ArrowFunctionNode): void {
364 const { body } = node
365 if (!body) return
366 if (node.type === "FunctionDeclaration" && node.id)
367 this.bind(node.id, "function", node, node)
368 const visitScope = () =>
369 this.inScope(node, () => {
370 for (const param of runtimeParamsOf(node))
371 this.bindPattern(param, "param", node, node)
372 if (body.type === "BlockStatement") {
373 body.parent = node
374 this.visitAll(body.body, body)
375 } else this.visit(body, node)
376 })
377 if (node.type === "FunctionExpression" && node.id) {
378 this.inScope(node, () => {
379 this.bind(node.id!, "function", node, node)
380 visitScope()
381 })
382 } else visitScope()
383 }
384
385 private visitClass(node: Class): void {
386 if (node.declare) return

Callers 1

visitMethod · 0.95

Calls 2

bindMethod · 0.95
inScopeMethod · 0.95

Tested by

no test coverage detected