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

Function isForwardingBinding

ark/aot/usage.ts:2257–2291  ·  view source on GitHub ↗
(
	binding: Binding,
	module: SourceModule,
	ctx: ThisReadsContext,
	seen: Set<Binding>
)

Source from the content-addressed store, hash-verified

2255}
2256
2257const isForwardingBinding = (
2258 binding: Binding,
2259 module: SourceModule,
2260 ctx: ThisReadsContext,
2261 seen: Set<Binding>
2262): boolean => {
2263 if (
2264 seen.has(binding) ||
2265 binding.writes.length > 0 ||
2266 mayOverrideForwarding(binding)
2267 )
2268 return false
2269 seen.add(binding)
2270 switch (binding.kind) {
2271 case "function":
2272 return (
2273 binding.declaration.type === "FunctionDeclaration" &&
2274 !isSkippedFunction(binding.declaration, module, ctx)
2275 )
2276 case "const":
2277 case "let":
2278 case "var":
2279 if (
2280 binding.declaration.type !== "VariableDeclarator" ||
2281 binding.declaration.id !== binding.id ||
2282 !binding.declaration.init
2283 )
2284 return false
2285 return isForwardingCallee(binding.declaration.init, module, ctx, seen)
2286 case "param":
2287 return isForwardingParam(binding, module, ctx, seen)
2288 default:
2289 return false
2290 }
2291}
2292
2293// whether any reference or export exposes the function to something other than
2294// calling it (or calling its `.call` / `.apply`), so an alias

Callers 1

isForwardingCalleeFunction · 0.85

Calls 6

mayOverrideForwardingFunction · 0.85
isSkippedFunctionFunction · 0.85
isForwardingCalleeFunction · 0.85
isForwardingParamFunction · 0.85
hasMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected