(call: Node, runtime: RuntimeModule)
| 457 | |
| 458 | // a call's result, which holds errors unless it's past a test for them |
| 459 | private readResult(call: Node, runtime: RuntimeModule): void { |
| 460 | const [result, parent] = operatorOf(call) |
| 461 | if (parent?.type === "ExpressionStatement") return |
| 462 | if ( |
| 463 | parent?.type !== "VariableDeclarator" || |
| 464 | parent.init !== result || |
| 465 | parent.id.type !== "Identifier" |
| 466 | ) |
| 467 | return this.readErrors(result, parent) |
| 468 | const binding = runtime.module.scopes.bindingsById.get(parent.id)! |
| 469 | if ( |
| 470 | binding.kind !== "const" || |
| 471 | binding.exportNames.length || |
| 472 | runtime.passed.includes(binding) |
| 473 | ) { |
| 474 | this.used.add("errors") |
| 475 | return |
| 476 | } |
| 477 | for (const { id } of binding.references) { |
| 478 | if (isDead(id, runtime) || this.isPastErrorsTest(id, binding)) continue |
| 479 | const [operand, operator] = operatorOf(id) |
| 480 | this.readErrors(operand, operator) |
| 481 | } |
| 482 | } |
| 483 | |
| 484 | private readErrors(node: Node, parent: Node | null | undefined): void { |
| 485 | if (this.isErrorsTest(parent, node)) return |
no test coverage detected