Rename TIntermSelection to TIntermIfElse
Now that ternary nodes are not represented by TIntermSelection any
more, TIntermIfElse is an easier name to understand for newcomers to
the code.
BUG=angleproject:1490
TEST=angle_unittests
Change-Id: Ia1e04e356ab93409400245092a84533d7dfd129d
Reviewed-on: https://chromium-review.googlesource.com/385416
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/RewriteElseBlocks.cpp b/src/compiler/translator/RewriteElseBlocks.cpp
index d583e73..bbffc79 100644
--- a/src/compiler/translator/RewriteElseBlocks.cpp
+++ b/src/compiler/translator/RewriteElseBlocks.cpp
@@ -28,7 +28,7 @@
private:
const TType *mFunctionType;
- TIntermNode *rewriteSelection(TIntermSelection *selection);
+ TIntermNode *rewriteIfElse(TIntermIfElse *ifElse);
};
ElseBlockRewriter::ElseBlockRewriter()
@@ -46,19 +46,19 @@
for (size_t statementIndex = 0; statementIndex != node->getSequence()->size(); statementIndex++)
{
TIntermNode *statement = (*node->getSequence())[statementIndex];
- TIntermSelection *selection = statement->getAsSelectionNode();
- if (selection && selection->getFalseBlock() != nullptr)
+ TIntermIfElse *ifElse = statement->getAsIfElseNode();
+ if (ifElse && ifElse->getFalseBlock() != nullptr)
{
// Check for if / else if
- TIntermSelection *elseIfBranch = selection->getFalseBlock()->getAsSelectionNode();
+ TIntermIfElse *elseIfBranch = ifElse->getFalseBlock()->getAsIfElseNode();
if (elseIfBranch)
{
- selection->replaceChildNode(elseIfBranch, rewriteSelection(elseIfBranch));
+ ifElse->replaceChildNode(elseIfBranch, rewriteIfElse(elseIfBranch));
delete elseIfBranch;
}
- (*node->getSequence())[statementIndex] = rewriteSelection(selection);
- delete selection;
+ (*node->getSequence())[statementIndex] = rewriteIfElse(ifElse);
+ delete ifElse;
}
}
}
@@ -75,20 +75,20 @@
return true;
}
-TIntermNode *ElseBlockRewriter::rewriteSelection(TIntermSelection *selection)
+TIntermNode *ElseBlockRewriter::rewriteIfElse(TIntermIfElse *ifElse)
{
- ASSERT(selection != nullptr);
+ ASSERT(ifElse != nullptr);
nextTemporaryIndex();
- TIntermTyped *typedCondition = selection->getCondition()->getAsTyped();
+ TIntermTyped *typedCondition = ifElse->getCondition()->getAsTyped();
TIntermAggregate *storeCondition = createTempInitDeclaration(typedCondition);
- TIntermSelection *falseBlock = nullptr;
+ TIntermIfElse *falseBlock = nullptr;
TType boolType(EbtBool, EbpUndefined, EvqTemporary);
- if (selection->getFalseBlock())
+ if (ifElse->getFalseBlock())
{
TIntermAggregate *negatedElse = nullptr;
// crbug.com/346463
@@ -107,16 +107,16 @@
TIntermSymbol *conditionSymbolElse = createTempSymbol(boolType);
TIntermUnary *negatedCondition = new TIntermUnary(EOpLogicalNot, conditionSymbolElse);
- falseBlock = new TIntermSelection(negatedCondition,
- selection->getFalseBlock(), negatedElse);
+ falseBlock = new TIntermIfElse(negatedCondition, ifElse->getFalseBlock(), negatedElse);
}
TIntermSymbol *conditionSymbolSel = createTempSymbol(boolType);
- TIntermSelection *newSelection = new TIntermSelection(conditionSymbolSel, selection->getTrueBlock(), falseBlock);
+ TIntermIfElse *newIfElse =
+ new TIntermIfElse(conditionSymbolSel, ifElse->getTrueBlock(), falseBlock);
TIntermAggregate *block = new TIntermAggregate(EOpSequence);
block->getSequence()->push_back(storeCondition);
- block->getSequence()->push_back(newSelection);
+ block->getSequence()->push_back(newIfElse);
return block;
}