| 555 | } |
| 556 | |
| 557 | BoolExprNode* ComparativeBoolNode::pass1(thread_db* tdbb, CompilerScratch* csb) |
| 558 | { |
| 559 | bool invariantCheck = false; |
| 560 | |
| 561 | switch (blrOp) |
| 562 | { |
| 563 | case blr_like: |
| 564 | case blr_similar: |
| 565 | case blr_containing: |
| 566 | case blr_starting: |
| 567 | invariantCheck = true; |
| 568 | break; |
| 569 | } |
| 570 | |
| 571 | doPass1(tdbb, csb, arg1.getAddress()); |
| 572 | |
| 573 | if (invariantCheck) |
| 574 | { |
| 575 | // We need to take care of invariantness expressions to be able to pre-compile the pattern. |
| 576 | nodFlags |= FLAG_INVARIANT; |
| 577 | csb->csb_current_nodes.push(this); |
| 578 | } |
| 579 | |
| 580 | doPass1(tdbb, csb, arg2.getAddress()); |
| 581 | doPass1(tdbb, csb, arg3.getAddress()); |
| 582 | |
| 583 | if (invariantCheck) |
| 584 | { |
| 585 | csb->csb_current_nodes.pop(); |
| 586 | |
| 587 | // If there is no top-level RSE present and patterns are not constant, unmark node as invariant |
| 588 | // because it may be dependent on data or variables. |
| 589 | if ((nodFlags & FLAG_INVARIANT) && |
| 590 | (!nodeIs<LiteralNode>(arg2) || (arg3 && !nodeIs<LiteralNode>(arg3)))) |
| 591 | { |
| 592 | for (const auto& ctxNode : csb->csb_current_nodes) |
| 593 | { |
| 594 | if (nodeIs<RseNode>(ctxNode)) |
| 595 | return this; |
| 596 | } |
| 597 | |
| 598 | nodFlags &= ~FLAG_INVARIANT; |
| 599 | } |
| 600 | } |
| 601 | |
| 602 | return this; |
| 603 | } |
| 604 | |
| 605 | void ComparativeBoolNode::pass2Boolean(thread_db* tdbb, CompilerScratch* csb, std::function<void ()> process) |
| 606 | { |
nothing calls this directly
no test coverage detected