({ code, program }, s)
| 2183 | const minLazyText = 12_000 |
| 2184 | |
| 2185 | const functionsAsArrows: UnitsPass = ({ code, program }, s) => { |
| 2186 | for (const statement of program.body as Node[]) { |
| 2187 | if (statement.type !== "VariableDeclaration") continue |
| 2188 | for (const { init } of statement.declarations) { |
| 2189 | if (!init || !isPlainFunction(init)) continue |
| 2190 | let readsOwn = false |
| 2191 | walk(init, node => { |
| 2192 | if ( |
| 2193 | node.type === "ThisExpression" || |
| 2194 | (node.type === "Identifier" && node.name === "arguments") |
| 2195 | ) |
| 2196 | readsOwn = true |
| 2197 | return !readsOwn |
| 2198 | }) |
| 2199 | if (readsOwn) continue |
| 2200 | s.overwrite( |
| 2201 | init.start, |
| 2202 | init.body.start, |
| 2203 | `${code.slice(init.start + "function".length, init.body.start).trim()} => ` |
| 2204 | ) |
| 2205 | } |
| 2206 | } |
| 2207 | return true |
| 2208 | } |
| 2209 | |
| 2210 | const applyName = /Apply(?:\$\d+)?$/ |
| 2211 |
nothing calls this directly
no test coverage detected