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

Method exposedKindOf

ark/aot/graph.ts:4198–4228  ·  view source on GitHub ↗
(
		member: MemberExpression,
		module: SourceModule,
		kindOfKey: KindOfKey
	)

Source from the content-addressed store, hash-verified

4196 // e.g. data for `opts.db` given `route({ db, input: type(...) })`, or
4197 // `$setup.User` in a Vue render function
4198 private exposedKindOf(
4199 member: MemberExpression,
4200 module: SourceModule,
4201 kindOfKey: KindOfKey
4202 ): KindBits {
4203 const object = unwrapChain(member.object)
4204 const name = memberNameOf(member)
4205 const context = module.scopes.byId.get(object)?.binding
4206 if (
4207 context?.kind !== "param" ||
4208 !(context.name in componentContexts) ||
4209 typeof name !== "string"
4210 )
4211 return 0
4212 const { bindings } = module.scopes.root
4213 if (bindings[name]) return kindOfKey(bindings[name], module)
4214 const options =
4215 bindings._sfc_main &&
4216 this.bindingLiteralOf(bindings._sfc_main, module, kindOfKey, new Set())
4217 let result = 0
4218 for (const key of ["setup", "data"]) {
4219 const fn = options && this.valueIn(options, key)
4220 const returned = fn && isFunctionNode(fn.node) && returnedOf(fn.node)
4221 const exposed =
4222 returned && this.literalOf(returned, fn.module, fn.kindOfKey)
4223 const value = exposed && this.valueIn(exposed, name)
4224 if (value)
4225 result |= this.transfer(value.node, value.module, value.kindOfKey)
4226 }
4227 return result
4228 }
4229
4230 private passedMemberKindOf(
4231 member: MemberExpression,

Callers 1

memberKindInMethod · 0.95

Calls 9

bindingLiteralOfMethod · 0.95
valueInMethod · 0.95
literalOfMethod · 0.95
transferMethod · 0.95
unwrapChainFunction · 0.90
isFunctionNodeFunction · 0.85
memberNameOfFunction · 0.70
returnedOfFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected