(module: SourceModule, kept: KeptCode)
| 529 | } |
| 530 | |
| 531 | const keptCallsIn = (module: SourceModule, kept: KeptCode) => { |
| 532 | const result: { |
| 533 | statement: Node |
| 534 | declaration: Extract<Node, { type: "VariableDeclaration" }> |
| 535 | call: Call |
| 536 | }[] = [] |
| 537 | for (const statement of module.program.body) { |
| 538 | const declaration = |
| 539 | statement.type === "ExportNamedDeclaration" ? |
| 540 | statement.declaration |
| 541 | : statement |
| 542 | if ( |
| 543 | declaration?.type !== "VariableDeclaration" || |
| 544 | !kept.statements.has(statement) |
| 545 | ) |
| 546 | continue |
| 547 | for (const { init } of declaration.declarations) { |
| 548 | const call = init && unwrapExpression(init) |
| 549 | if (call?.type !== "CallExpression") continue |
| 550 | // a validator held with what sets the cells it reads |
| 551 | const held = call.arguments[0] |
| 552 | result.push({ |
| 553 | statement, |
| 554 | declaration, |
| 555 | call: |
| 556 | isHeldCall(call, module) && held?.type === "CallExpression" ? |
| 557 | held |
| 558 | : call |
| 559 | }) |
| 560 | } |
| 561 | } |
| 562 | return result |
| 563 | } |
| 564 | |
| 565 | // if it reads only units and runtime members that don't change after load, as configuration may |
| 566 | const creatorFnOf = (module: SourceModule): string | undefined => { |
no test coverage detected