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

Method visitExport

ark/aot/scope.ts:441–475  ·  view source on GitHub ↗
(
		node: Extract<Node, { type: "ExportNamedDeclaration" }>
	)

Source from the content-addressed store, hash-verified

439 }
440
441 private visitExport(
442 node: Extract<Node, { type: "ExportNamedDeclaration" }>
443 ): void {
444 if (node.exportKind === "type") return
445 // a namespace's export is a member of it, not of the module
446 if (this.scope !== this.root) return this.visit(node.declaration, node)
447 if (node.declaration) {
448 this.visit(node.declaration, node)
449 for (const id of declaredIds(node.declaration)) {
450 const binding = this.bindingsById.get(id)
451 if (binding)
452 this.exportsByName[binding.name] = { kind: "binding", binding }
453 }
454 return
455 }
456 for (const specifier of node.specifiers) {
457 specifier.parent = node
458 if (specifier.exportKind === "type") continue
459 const name = exportNameOf(specifier.exported)
460 if (node.source) {
461 this.exportsByName[name] = {
462 kind: "reexport",
463 specifier: node.source.value,
464 name: exportNameOf(specifier.local)
465 }
466 } else {
467 const reference = this.reference(
468 specifier.local as IdentifierReference,
469 false
470 )
471 specifier.local.parent = specifier
472 this.pendingExports.push([name, reference])
473 }
474 }
475 }
476
477 private visitTarget(target: Node, parent: Node): void {
478 target.parent = parent

Callers 1

visitMethod · 0.95

Calls 6

visitMethod · 0.95
referenceMethod · 0.95
declaredIdsFunction · 0.85
exportNameOfFunction · 0.70
getMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected