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

Method transfer

ark/aot/graph.ts:3796–3870  ·  view source on GitHub ↗
(
		node: Node,
		module: SourceModule,
		kindOfKey: KindOfKey
	)

Source from the content-addressed store, hash-verified

3794 }
3795
3796 private transfer(
3797 node: Node,
3798 module: SourceModule,
3799 kindOfKey: KindOfKey
3800 ): KindBits {
3801 const cast = castOf(node)
3802 if (cast) {
3803 // a cast is data whatever reached it
3804 if (
3805 this.annotatedKindOf(cast, module, () => kinds.unknown) === kinds.data
3806 )
3807 return kinds.data
3808 return annotate(
3809 this.transfer(unwrapChain(node), module, kindOfKey),
3810 this.annotatedKindOf(cast, module, kindOfKey)
3811 )
3812 }
3813 node = unwrapChain(node)
3814 const cached =
3815 this.bindingKindOfKeys.has(kindOfKey) ?
3816 undefined
3817 : this.kindsByNode.get(node)
3818 if (cached !== undefined) return cached
3819 switch (node.type) {
3820 case "Identifier": {
3821 const binding = module.scopes.byId.get(node)?.binding
3822 return binding ? kindOfKey(binding, module) : kinds.data
3823 }
3824 case "ArrowFunctionExpression":
3825 case "FunctionExpression":
3826 return functionKindOf(kindOfKey(node, module))
3827 case "MemberExpression": {
3828 const exported = this.namespaceMemberOf(node, module)
3829 if (exported) return this.targetKindOf(exported, kindOfKey)
3830 return this.memberKindIn(
3831 node,
3832 { node: node.object, module, kindOfKey },
3833 new Set()
3834 )
3835 }
3836 case "CallExpression":
3837 case "TaggedTemplateExpression":
3838 return this.calledKindOf(node, module, kindOfKey)
3839 case "ConditionalExpression":
3840 return (
3841 this.transfer(node.consequent, module, kindOfKey) |
3842 this.transfer(node.alternate, module, kindOfKey)
3843 )
3844 case "LogicalExpression":
3845 return (
3846 this.transfer(node.left, module, kindOfKey) |
3847 this.transfer(node.right, module, kindOfKey)
3848 )
3849 case "SequenceExpression":
3850 return this.transfer(
3851 node.expressions[node.expressions.length - 1],
3852 module,
3853 kindOfKey

Callers 15

kindOfMethod · 0.95
keyKindOfMethod · 0.95
writtenKindOfMethod · 0.95
namespaceKindOfMethod · 0.95
storedKindOfMethod · 0.95
destructuredWriteOfMethod · 0.95
iteratedKindOfMethod · 0.95
argKindOfMethod · 0.95
argsKindOfMethod · 0.95
passedKindOfMethod · 0.95
queryKindOfMethod · 0.95

Calls 13

annotatedKindOfMethod · 0.95
namespaceMemberOfMethod · 0.95
targetKindOfMethod · 0.95
memberKindInMethod · 0.95
calledKindOfMethod · 0.95
holderKindOfMethod · 0.95
thisKindOfMethod · 0.95
unwrapChainFunction · 0.90
castOfFunction · 0.85
functionKindOfFunction · 0.85
annotateFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected