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/Intermediate.cpp b/src/compiler/translator/Intermediate.cpp
index 53eaa6f..d018260 100644
--- a/src/compiler/translator/Intermediate.cpp
+++ b/src/compiler/translator/Intermediate.cpp
@@ -172,37 +172,35 @@
return aggNode;
}
-//
// For "if" test nodes. There are three children; a condition,
// a true path, and a false path. The two paths are in the
// nodePair.
//
-// Returns the selection node created.
-//
-TIntermNode *TIntermediate::addSelection(
- TIntermTyped *cond, TIntermNodePair nodePair, const TSourceLoc &line)
+// Returns the node created.
+TIntermNode *TIntermediate::addIfElse(TIntermTyped *cond,
+ TIntermNodePair nodePair,
+ const TSourceLoc &line)
{
- //
- // For compile time constant selections, prune the code and
- // test now.
- //
+ // For compile time constant conditions, prune the code now.
if (cond->getAsConstantUnion())
{
if (cond->getAsConstantUnion()->getBConst(0) == true)
{
- return nodePair.node1 ? setAggregateOperator(
- nodePair.node1, EOpSequence, nodePair.node1->getLine()) : NULL;
+ return nodePair.node1 ? setAggregateOperator(nodePair.node1, EOpSequence,
+ nodePair.node1->getLine())
+ : nullptr;
}
else
{
- return nodePair.node2 ? setAggregateOperator(
- nodePair.node2, EOpSequence, nodePair.node2->getLine()) : NULL;
+ return nodePair.node2 ? setAggregateOperator(nodePair.node2, EOpSequence,
+ nodePair.node2->getLine())
+ : nullptr;
}
}
- TIntermSelection *node = new TIntermSelection(
- cond, ensureSequence(nodePair.node1), ensureSequence(nodePair.node2));
+ TIntermIfElse *node =
+ new TIntermIfElse(cond, ensureSequence(nodePair.node1), ensureSequence(nodePair.node2));
node->setLine(line);
return node;