| 564 | |
| 565 | // `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed) |
| 566 | if(condition: Code | boolean, thenBody?: Block, elseBody?: Block): CodeGen { |
| 567 | this._blockNode(new If(condition)) |
| 568 | |
| 569 | if (thenBody && elseBody) { |
| 570 | this.code(thenBody).else().code(elseBody).endIf() |
| 571 | } else if (thenBody) { |
| 572 | this.code(thenBody).endIf() |
| 573 | } else if (elseBody) { |
| 574 | throw new Error('CodeGen: "else" body without "then" body') |
| 575 | } |
| 576 | return this |
| 577 | } |
| 578 | |
| 579 | // `else if` clause - invalid without `if` or after `else` clauses |
| 580 | elseIf(condition: Code | boolean): CodeGen { |