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

Method finalize

ark/aot/precompile.ts:6821–6847  ·  view source on GitHub ↗
(candidate: SiteCandidate, module: SourceModule)

Source from the content-addressed store, hash-verified

6819 }
6820
6821 private finalize(candidate: SiteCandidate, module: SourceModule): Site {
6822 const { state } = candidate
6823 const site = this.siteOf(candidate, module)
6824 if (this.mode === "standalone" && isInIsland(state.node, module)) {
6825 site.status = "island"
6826 return site
6827 }
6828 const dynamic =
6829 this.receiveValue(site, state, module) ?? this.writtenElsewhereIn(state)
6830 if (dynamic) return refuseDynamic(site, dynamic)
6831 const runsFirst = runsBeforeBody(state.node, module)
6832 const unreadable = this.receiveReads(site, candidate, module, runsFirst)
6833 if (unreadable) return refuseDynamic(site, unreadable)
6834 this.receiveHelpers(site, state, module, runsFirst)
6835 for (const [binding, declaring, reader] of state.trace.readFirst) {
6836 if (declaring === module) continue
6837 const unchecked = this.receiveReadFirst(site, binding, declaring, reader)
6838 if (unchecked) {
6839 return refuseDynamic(
6840 site,
6841 new DynamicValue(module, state.node, unchecked)
6842 )
6843 }
6844 }
6845 this.collectReferences(site, state, module, runsFirst)
6846 return site
6847 }
6848
6849 // what the site evaluated to, or why the build refuses it
6850 private receiveValue(

Callers 1

_analyzeMethod · 0.95

Calls 10

siteOfMethod · 0.95
receiveValueMethod · 0.95
writtenElsewhereInMethod · 0.95
receiveReadsMethod · 0.95
receiveHelpersMethod · 0.95
receiveReadFirstMethod · 0.95
collectReferencesMethod · 0.95
refuseDynamicFunction · 0.90
runsBeforeBodyFunction · 0.90
isInIslandFunction · 0.85

Tested by

no test coverage detected