Handled case where selection nodes that use ternary operators are part of a sequence. Usually they are part of an assignment.
BUG=4
TEST=OpenGL ES 2.0 conformance tests, specifically operators test.
Review URL: http://codereview.appspot.com/1643043
git-svn-id: https://angleproject.googlecode.com/svn/trunk@335 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/compiler/OutputGLSL.cpp b/src/compiler/OutputGLSL.cpp
index 462ac86..45d4fd0 100644
--- a/src/compiler/OutputGLSL.cpp
+++ b/src/compiler/OutputGLSL.cpp
@@ -47,18 +47,18 @@
}
bool isSingleStatement(TIntermNode* node) {
- const TIntermAggregate* aggregate = node->getAsAggregate();
- if (aggregate != NULL)
+ if (const TIntermAggregate* aggregate = node->getAsAggregate())
{
- if ((aggregate->getOp() == EOpFunction) ||
- (aggregate->getOp() == EOpSequence))
- return false;
+ return (aggregate->getOp() != EOpFunction) &&
+ (aggregate->getOp() != EOpSequence);
}
- else if (node->getAsSelectionNode() != NULL)
+ else if (const TIntermSelection* selection = node->getAsSelectionNode())
{
- return false;
+ // Ternary operators are usually part of an assignment operator.
+ // This handles those rare cases in which they are all by themselves.
+ return selection->usesTernaryOperator();
}
- else if (node->getAsLoopNode() != NULL)
+ else if (node->getAsLoopNode())
{
return false;
}