(
call: Extract<Node, { type: "CallExpression" }>,
module: SourceModule,
held: Held,
wrap: readonly Key[] | undefined,
index = 0,
flattens = false,
argIndex = 0
)
| 1302 | |
| 1303 | // a callback passed what its call reads, whose returns the call holds at wrap |
| 1304 | private callback( |
| 1305 | call: Extract<Node, { type: "CallExpression" }>, |
| 1306 | module: SourceModule, |
| 1307 | held: Held, |
| 1308 | wrap: readonly Key[] | undefined, |
| 1309 | index = 0, |
| 1310 | flattens = false, |
| 1311 | argIndex = 0 |
| 1312 | ): void { |
| 1313 | const callback = call.arguments[argIndex] |
| 1314 | if (!callback || callback.type === "SpreadElement") return |
| 1315 | const value = this.valueOf(callback, module) |
| 1316 | if (value?.kind !== "function") { |
| 1317 | return this.lose( |
| 1318 | callback, |
| 1319 | module, |
| 1320 | "passes it to a callback the build can't follow" |
| 1321 | ) |
| 1322 | } |
| 1323 | if (readsArguments(value.fn)) { |
| 1324 | return this.lose( |
| 1325 | callback, |
| 1326 | module, |
| 1327 | "passes it to a function reading arguments" |
| 1328 | ) |
| 1329 | } |
| 1330 | const param = runtimeParamsOf(value.fn)[index] |
| 1331 | if (param?.type === "RestElement") { |
| 1332 | this.bindPattern(param.argument, value.module, { |
| 1333 | ...held, |
| 1334 | path: [anyKey, ...held.path] |
| 1335 | }) |
| 1336 | } else if (param) this.bindPattern(param, value.module, held) |
| 1337 | if (wrap) { |
| 1338 | this.addEntry( |
| 1339 | value.fn, |
| 1340 | flattens ? { call, module, wrap, flattens } : { call, module, wrap } |
| 1341 | ) |
| 1342 | } |
| 1343 | } |
| 1344 | |
| 1345 | // passed as an argument |
| 1346 | private pass( |
no test coverage detected