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

Method declarationOf

ark/aot/link.ts:1360–1381  ·  view source on GitHub ↗
(
		unit: Unit,
		binding: Binding
	)

Source from the content-addressed store, hash-verified

1358 }
1359
1360 private declarationOf(
1361 unit: Unit,
1362 binding: Binding
1363 ): [Unit, Binding] | undefined {
1364 for (let depth = 0; depth < 16; depth++) {
1365 if (binding.kind === "const" || binding.kind === "function")
1366 return unit.isSite ? undefined : [unit, binding]
1367 const specifier = binding.declaration
1368 if (
1369 binding.kind !== "import" ||
1370 specifier.type !== "ImportSpecifier" ||
1371 specifier.parent?.type !== "ImportDeclaration"
1372 )
1373 return
1374 const target = this.unitsByKey.get(specifier.parent.source.value)
1375 const exported =
1376 target?.module.scopes.exportsByName[exportNameOf(specifier.imported)]
1377 if (!target || exported?.kind !== "binding") return
1378 unit = target
1379 binding = exported.binding
1380 }
1381 }
1382
1383 private inline(owner: Unit, binding: Binding, read: Read): boolean {
1384 const declarator = binding.declaration

Callers 7

readAllowsAsCreatedMethod · 0.95
declareCreatedMethod · 0.95
declareAsCreatedMethod · 0.95
readMethod · 0.95
inlineMethod · 0.95
localOfMethod · 0.95
declareMethod · 0.45

Calls 2

exportNameOfFunction · 0.90
getMethod · 0.65

Tested by

no test coverage detected