| 574 | } |
| 575 | |
| 576 | export class IfScan implements ProposalProvider { |
| 577 | id: string; |
| 578 | branches: IfBranch[]; |
| 579 | vars: Variable[]; |
| 580 | args: Variable[]; |
| 581 | outputs: Variable[]; |
| 582 | internalVars: Variable[]; |
| 583 | resolved: any[]; |
| 584 | resolvedOutputs: any[]; |
| 585 | exclusive: boolean; |
| 586 | hasAggregate: boolean; |
| 587 | hasResolvedOutputs: boolean; |
| 588 | proposalObject: Proposal; |
| 589 | |
| 590 | constructor(id: string, args: Variable[], outputs: Variable[], branches: IfBranch[], hasAggregate = false) { |
| 591 | this.id = id; |
| 592 | this.branches = branches; |
| 593 | this.outputs = outputs; |
| 594 | this.hasAggregate = hasAggregate; |
| 595 | this.resolved = []; |
| 596 | this.resolvedOutputs = []; |
| 597 | this.hasResolvedOutputs = false; |
| 598 | let blockVars = []; |
| 599 | this.vars = args.slice(); |
| 600 | for(let branch of branches) { |
| 601 | if(branch.exclusive) this.exclusive = true; |
| 602 | } |
| 603 | for(let output of outputs) { |
| 604 | if(output !== undefined && isVariable(output)) { |
| 605 | this.vars[output.id] = output; |
| 606 | blockVars[output.id] = output; |
| 607 | } |
| 608 | } |
| 609 | for(let arg of args) { |
| 610 | if(isVariable(arg)) { |
| 611 | blockVars[arg.id] = arg; |
| 612 | } |
| 613 | } |
| 614 | this.args = args; |
| 615 | this.internalVars = blockVars; |
| 616 | this.proposalObject = {providing: null, index: null, cardinality: 0}; |
| 617 | } |
| 618 | |
| 619 | resolve(prefix) { |
| 620 | return resolve(this.args, prefix, this.resolved); |
| 621 | } |
| 622 | |
| 623 | resolveOutputs(prefix) { |
| 624 | this.hasResolvedOutputs = false; |
| 625 | let resolved = resolve(this.outputs, prefix, this.resolvedOutputs); |
| 626 | for(let item of resolved) { |
| 627 | if(item !== undefined) { |
| 628 | this.hasResolvedOutputs = true; |
| 629 | break; |
| 630 | } |
| 631 | } |
| 632 | return resolved; |
| 633 | } |
nothing calls this directly
no outgoing calls
no test coverage detected