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

Method result

ark/aot/graph.ts:4309–4343  ·  view source on GitHub ↗
(key, keyModule)

Source from the content-addressed store, hash-verified

4307 const params = runtimeParamsOf(fn)
4308 const derived = new Map<Key, KindBits>()
4309 const result: KindOfKey = (key, keyModule) => {
4310 const index =
4311 "kind" in key && key.kind === "param" && key.declaration === fn ?
4312 params.findIndex(param => contains(param, key.id))
4313 : undefined
4314 // what fn declares, for the `T` passed, e.g. `N` in
4315 // `{ const N = T.or("null"); return N }`
4316 const anchor = anchorOf(key)
4317 if (
4318 index === undefined &&
4319 (keyModule !== module || anchor === fn || !contains(fn, anchor))
4320 )
4321 return kindOfKey(key, keyModule)
4322 let kind = derived.get(key)
4323 if (kind !== undefined) return kind
4324 // read while derived: a parameter holds what the call passes, else
4325 // what any call gives it
4326 kind =
4327 index === undefined ? kindOfKey(key, keyModule)
4328 : index === -1 ? kinds.data
4329 : this.patternKindOf(
4330 (key as Binding).id,
4331 params[index],
4332 args[index],
4333 module,
4334 result
4335 )
4336 derived.set(key, kind)
4337 kind =
4338 index === undefined ?
4339 this.keyKindOf(key, keyModule, result)
4340 : kind | this.writtenKindOf(key as Binding, module, result)
4341 derived.set(key, kind)
4342 return kind
4343 }
4344 this.bindingKindOfKeys.add(result)
4345 return result
4346 }

Callers

nothing calls this directly

Calls 7

patternKindOfMethod · 0.95
keyKindOfMethod · 0.95
writtenKindOfMethod · 0.95
anchorOfFunction · 0.85
containsFunction · 0.70
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected