( node: Node, runtime: RuntimeModule, path: readonly string[] = [] )
| 570 | |
| 571 | // a validator, or an object literal holding one at path, as a value |
| 572 | private readValue( |
| 573 | node: Node, |
| 574 | runtime: RuntimeModule, |
| 575 | path: readonly string[] = [] |
| 576 | ): void { |
| 577 | const [operand, parent] = operatorOf(node) |
| 578 | const declaration = parent?.parent |
| 579 | if ( |
| 580 | parent?.type === "VariableDeclarator" && |
| 581 | parent.init === operand && |
| 582 | parent.id.type === "Identifier" && |
| 583 | declaration?.type === "VariableDeclaration" && |
| 584 | declaration.kind === "const" |
| 585 | ) { |
| 586 | // a namespace's export is read off the namespace |
| 587 | if ( |
| 588 | declaration.parent?.type === "ExportNamedDeclaration" && |
| 589 | declaration.parent.parent?.type !== "Program" |
| 590 | ) { |
| 591 | escape( |
| 592 | `${runtime.module.positionOf(declaration)} exports a validator from a namespace` |
| 593 | ) |
| 594 | } |
| 595 | return this.readBinding( |
| 596 | runtime.module.scopes.bindingsById.get(parent.id)!, |
| 597 | runtime, |
| 598 | path |
| 599 | ) |
| 600 | } |
| 601 | this.read(operand, parent, runtime, path) |
| 602 | } |
| 603 | |
| 604 | private readBinding( |
| 605 | binding: Binding, |
no test coverage detected