Create a for-loop sequence.
| 2675 | // Create a for-loop sequence. |
| 2676 | // |
| 2677 | TIntermAggregate* TIntermediate::addForLoop(TIntermNode* body, TIntermNode* initializer, TIntermNode* test, |
| 2678 | TIntermTyped* terminal, bool testFirst, const TSourceLoc& loc, TIntermLoop*& node) |
| 2679 | { |
| 2680 | node = new TIntermLoop(body, test, terminal, testFirst); |
| 2681 | node->setLoc(loc); |
| 2682 | |
| 2683 | // make a sequence of the initializer and statement, but try to reuse the |
| 2684 | // aggregate already created for whatever is in the initializer, if there is one |
| 2685 | TIntermAggregate* loopSequence = (initializer == nullptr || |
| 2686 | initializer->getAsAggregate() == nullptr) ? makeAggregate(initializer, loc) |
| 2687 | : initializer->getAsAggregate(); |
| 2688 | if (loopSequence != nullptr && (loopSequence->getOp() == EOpSequence || loopSequence->getOp() == EOpScope)) |
| 2689 | loopSequence->setOp(EOpNull); |
| 2690 | loopSequence = growAggregate(loopSequence, node); |
| 2691 | loopSequence->setOperator(getDebugInfo() ? EOpScope : EOpSequence); |
| 2692 | |
| 2693 | return loopSequence; |
| 2694 | } |
| 2695 | |
| 2696 | // |
| 2697 | // Add branches. |
no test coverage detected