Split ternary node class from TIntermSelection
Ternary operator nodes are typed parts of expressions, they always
have two children and the children are also guaranteed to be
TIntermTyped. "If" selection nodes can't be a part of an expression,
they can have either one or two children and the children are code
blocks. Due to all of these differences it makes sense to store these
using two different AST node classes.
BUG=angleproject:1490
TEST=angle_unittests
Change-Id: I913ab1d806e3cdb5c21106f078cc9c0b6c72ac54
Reviewed-on: https://chromium-review.googlesource.com/384512
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/compiler/translator/SimplifyLoopConditions.cpp b/src/compiler/translator/SimplifyLoopConditions.cpp
index 61a68fc..da8da48 100644
--- a/src/compiler/translator/SimplifyLoopConditions.cpp
+++ b/src/compiler/translator/SimplifyLoopConditions.cpp
@@ -36,7 +36,7 @@
bool visitBinary(Visit visit, TIntermBinary *node) override;
bool visitAggregate(Visit visit, TIntermAggregate *node) override;
- bool visitSelection(Visit visit, TIntermSelection *node) override;
+ bool visitTernary(Visit visit, TIntermTernary *node) override;
void nextIteration();
bool foundLoopToChange() const { return mFoundLoopToChange; }
@@ -100,14 +100,14 @@
return !mFoundLoopToChange;
}
-bool SimplifyLoopConditionsTraverser::visitSelection(Visit visit, TIntermSelection *node)
+bool SimplifyLoopConditionsTraverser::visitTernary(Visit visit, TIntermTernary *node)
{
if (mFoundLoopToChange)
return false;
// Don't traverse ternary operators outside loop conditions.
if (!mInsideLoopConditionOrExpression)
- return !node->usesTernaryOperator();
+ return false;
mFoundLoopToChange = mConditionsToSimplify.match(node);
return !mFoundLoopToChange;