HLSL: Flesh out the loop grammar and productions.

This commit is contained in:
John Kessenich 2016-06-05 15:44:07 -06:00
parent 0d2b6de45b
commit 119f8f6906
11 changed files with 645 additions and 2 deletions

View file

@ -1028,7 +1028,7 @@ const TIntermTyped* TIntermediate::findLValueBase(const TIntermTyped* node, bool
}
//
// Create loop nodes.
// Create while and do-while loop nodes.
//
TIntermLoop* TIntermediate::addLoop(TIntermNode* body, TIntermTyped* test, TIntermTyped* terminal, bool testFirst, const TSourceLoc& loc)
{
@ -1038,6 +1038,22 @@ TIntermLoop* TIntermediate::addLoop(TIntermNode* body, TIntermTyped* test, TInte
return node;
}
//
// Create a for-loop sequence.
//
TIntermAggregate* TIntermediate::addForLoop(TIntermNode* body, TIntermNode* initializer, TIntermTyped* test, TIntermTyped* terminal, bool testFirst, const TSourceLoc& loc)
{
TIntermLoop* node = new TIntermLoop(body, test, terminal, testFirst);
node->setLoc(loc);
// make a sequence of the initializer and statement
TIntermAggregate* loopSequence = makeAggregate(initializer, loc);
loopSequence = growAggregate(loopSequence, node);
loopSequence->setOperator(EOpSequence);
return loopSequence;
}
//
// Add branches.
//