( binding: Binding, module: SourceModule )
| 7338 | !!staticBodyOf(fn) && !readsArguments(fn) |
| 7339 | |
| 7340 | export const functionOfBinding = ( |
| 7341 | binding: Binding, |
| 7342 | module: SourceModule |
| 7343 | ): FunctionNode | undefined => { |
| 7344 | if (binding.writes.length) return |
| 7345 | const fn = |
| 7346 | binding.kind === "function" ? binding.declaration |
| 7347 | : ( |
| 7348 | binding.kind === "const" && |
| 7349 | binding.declaration.type === "VariableDeclarator" |
| 7350 | ) ? |
| 7351 | binding.declaration.init && |
| 7352 | namedFunctionOf(unwrapExpression(binding.declaration.init), module) |
| 7353 | : undefined |
| 7354 | return fn && isFunctionNode(fn) ? fn : undefined |
| 7355 | } |
| 7356 | |
| 7357 | // esbuild's keepNames: `__name(fn, "name")` returns `fn` |
| 7358 | const namedFunctionOf = (node: Node, module: SourceModule): Node => { |
no test coverage detected