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

Method closedPredicateTextOf

ark/aot/precompile.ts:1492–1517  ·  view source on GitHub ↗
(
		site: Site,
		reference: Site["references"][number]
	)

Source from the content-addressed store, hash-verified

1490 // reading only its argument is written where it's read; any other, in its
1491 // cell's module, by a call, so nothing names it for a variable holding it
1492 private closedPredicateTextOf(
1493 site: Site,
1494 reference: Site["references"][number]
1495 ): CellText | undefined {
1496 const { value } = reference
1497 const standIn = this.standInOf(value)
1498 const node = standIn?.closure?.node
1499 const created = createdBy(site)
1500 if (
1501 !node ||
1502 !created ||
1503 reference.binding ||
1504 reference.start !== node.start ||
1505 reference.end !== node.end ||
1506 declaredNameOf(node) !== "" ||
1507 // a read of its Type before its site has run throws where a site sets it
1508 this.isOnCycle(standIn!.module) ||
1509 !rootsIn(created).some(root =>
1510 root.references.some(
1511 ref => ref.is("predicate") && ref.predicate === value
1512 )
1513 )
1514 )
1515 return
1516 return this.cellTextOf(cellNameOf(value), node, standIn!.module)
1517 }
1518
1519 // a function's text as its cell's module holds it: what it reads of another
1520 // module is imported there from the module declaring it, under a name of

Callers 1

cellsOfMethod · 0.95

Calls 8

standInOfMethod · 0.95
isOnCycleMethod · 0.95
cellTextOfMethod · 0.95
createdByFunction · 0.90
declaredNameOfFunction · 0.90
rootsInFunction · 0.90
cellNameOfFunction · 0.85
isMethod · 0.80

Tested by

no test coverage detected