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

Method receiveReadFirst

ark/aot/precompile.ts:3722–3745  ·  view source on GitHub ↗
(
		site: Site,
		binding: Binding,
		declaring: SourceModule,
		reader: string
	)

Source from the content-addressed store, hash-verified

3720
3721 // so a fold throws before `Base` is set, as arktype would
3722 private receiveReadFirst(
3723 site: Site,
3724 binding: Binding,
3725 declaring: SourceModule,
3726 reader: string
3727 ): string | undefined {
3728 // a test driver registers helpers once their module ran
3729 if (
3730 this.checkHelpers &&
3731 site.helpers.some(helper => helper.file === declaring.id)
3732 )
3733 return
3734 if (!binding.exportNames.length)
3735 return `\`${reader}\` can run before \`${binding.name}\` (${declaring.positionOf(binding.id)}) is set; export \`${binding.name}\` so the site can receive it`
3736 const input: Input = {
3737 kind: "import",
3738 file: declaring.id,
3739 name: binding.exportNames[0],
3740 path: [],
3741 value: this.interpreter.valueOfBinding(binding, declaring)
3742 }
3743 if (!site.inputs.some(existing => isCoveredBy(input, existing)))
3744 site.inputs.push(input)
3745 }
3746
3747 // whether a cycle can call the module's sites first
3748 private isReachedEarly(module: SourceModule): boolean {

Callers 1

finalizeMethod · 0.95

Calls 4

isCoveredByFunction · 0.90
positionOfMethod · 0.80
valueOfBindingMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected