(fn: Node, scopes: ModuleScopes)
| 1618 | node.type === "ArrowFunctionExpression" || node.type === "FunctionExpression" |
| 1619 | |
| 1620 | const forwardedOf = (fn: Node, scopes: ModuleScopes): Binding | undefined => { |
| 1621 | if (!isFunctionExpression(fn) || fn.async) return |
| 1622 | const [only] = fn.body.type === "BlockStatement" ? fn.body.body : [] |
| 1623 | const call = |
| 1624 | fn.body.type !== "BlockStatement" ? fn.body |
| 1625 | : fn.body.body.length === 1 && only.type === "ReturnStatement" ? |
| 1626 | only.argument |
| 1627 | : undefined |
| 1628 | if ( |
| 1629 | call?.type !== "CallExpression" || |
| 1630 | call.callee.type !== "Identifier" || |
| 1631 | !passesParams(call, fn) |
| 1632 | ) |
| 1633 | return |
| 1634 | return scopes.byId.get(call.callee)?.binding |
| 1635 | } |
| 1636 | |
| 1637 | // a function read once, as a call passing its own parameters, is its body where it's called |
| 1638 | const inlineCalls: UnitsPass = ({ code, program, scopes }, s, body) => { |
no test coverage detected