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

Method argKindOf

ark/aot/graph.ts:1972–1993  ·  view source on GitHub ↗
(
		call: CallExpression | NewExpression,
		params: readonly Node[],
		index: number,
		module: SourceModule,
		kindOfKey: KindOfKey
	)

Source from the content-addressed store, hash-verified

1970
1971 // e.g. what `[A]` holds for `t` given `f(...[A])`, or an array of it for `...ts`
1972 private argKindOf(
1973 call: CallExpression | NewExpression,
1974 params: readonly Node[],
1975 index: number,
1976 module: SourceModule,
1977 kindOfKey: KindOfKey
1978 ): KindBits {
1979 const args = call.arguments
1980 const spread = args.findIndex(arg => arg.type === "SpreadElement")
1981 const isRest = params[index]?.type === "RestElement"
1982 if (!isRest && (spread === -1 || index < spread)) {
1983 return args[index] ?
1984 this.transfer(args[index], module, kindOfKey)
1985 : kinds.data
1986 }
1987 const held = this.argsKindOf(
1988 args.slice(spread === -1 ? index : Math.min(spread, index)),
1989 module,
1990 kindOfKey
1991 )
1992 return isRest ? holderOf(held) : held | kinds.data
1993 }
1994
1995 // what any of args holds, a spread's members as its own
1996 private argsKindOf(

Callers 3

paramKindOfMethod · 0.95
passedMemberKindInMethod · 0.95
applicationOfMethod · 0.95

Calls 3

transferMethod · 0.95
argsKindOfMethod · 0.95
holderOfFunction · 0.70

Tested by

no test coverage detected