( binding: Binding, module: SourceModule, ctx: ThisReadsContext, seen: Set<Binding> )
| 2255 | } |
| 2256 | |
| 2257 | const 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 |
no test coverage detected