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

Method thisKindOf

ark/aot/graph.ts:3953–3972  ·  view source on GitHub ↗
(
		node: ThisExpression | NewExpression,
		module: SourceModule,
		kindOfKey: KindOfKey
	)

Source from the content-addressed store, hash-verified

3951
3952 // `this`, or what `new` creates: the object or class that owns it
3953 private thisKindOf(
3954 node: ThisExpression | NewExpression,
3955 module: SourceModule,
3956 kindOfKey: KindOfKey
3957 ): KindBits {
3958 const owner = node.type === "ThisExpression" && ownerOf(node)
3959 if (owner && owner.type === "ObjectExpression")
3960 return this.transfer(owner, module, kindOfKey)
3961 // e.g. `static self = this`, which holds nothing until it holds something else
3962 const statics = node.type === "ThisExpression" && staticOwnerOf(node)
3963 if (statics)
3964 return this.holderKindOf(node, { node: statics, module, kindOfKey })
3965 const cls = this.classOf(node, module, kindOfKey)
3966 return (
3967 cls ? this.instanceKindOf(cls, kindOfKey)
3968 : node.type === "NewExpression" ?
3969 this.builtinPassedOf(node, module, kindOfKey)
3970 : kinds.data
3971 )
3972 }
3973
3974 // what `node` reads off `object`, where its name decides the read as the
3975 // member's own kind: e.g. a method's declared return, off whichever of

Callers 1

transferMethod · 0.95

Calls 7

transferMethod · 0.95
holderKindOfMethod · 0.95
classOfMethod · 0.95
instanceKindOfMethod · 0.95
builtinPassedOfMethod · 0.95
staticOwnerOfFunction · 0.85
ownerOfFunction · 0.70

Tested by

no test coverage detected