| 679 | } |
| 680 | |
| 681 | check(node: BaseNode, opts?: CheckOptions): this { |
| 682 | const arg = opts?.arg ?? this.data |
| 683 | const condition = |
| 684 | opts?.kind || (this.trav === "Apply" && node.is("union")) ? |
| 685 | undefined |
| 686 | : node.jsCond?.(this, arg) |
| 687 | const fail = () => (opts?.breaks ? this.line("break") : this.return(false)) |
| 688 | if (condition === undefined) |
| 689 | return this.if(`!${this.inv(node, opts)}`, fail) |
| 690 | return this.if( |
| 691 | this.trav === "Allows" ? |
| 692 | `!(${condition})` |
| 693 | : `!(${condition}) && ${this.error(node, undefined, arg)}`, |
| 694 | fail |
| 695 | ) |
| 696 | } |
| 697 | |
| 698 | checkLeaf(node: BaseNode): this { |
| 699 | const condition = node.jsCond!(this, this.data)! |