Promote unary nodes automatically

Unary nodes now get their type set automatically based on the
operation and operand. The operand should only be changed to another
of the same type after the node is constructed. The operation can't
be changed on unary and binary nodes after they've been constructed.

BUG=angleproject:1490
TEST=angle_unittests

Change-Id: Ib1ea3dcb1162261966c02d5f03d8091cf647fac1
Reviewed-on: https://chromium-review.googlesource.com/378935
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/RewriteDoWhile.cpp b/src/compiler/translator/RewriteDoWhile.cpp
index 8347447..eac6751 100644
--- a/src/compiler/translator/RewriteDoWhile.cpp
+++ b/src/compiler/translator/RewriteDoWhile.cpp
@@ -102,8 +102,8 @@
                 TIntermAggregate *breakBlock = new TIntermAggregate(EOpSequence);
                 breakBlock->getSequence()->push_back(breakStatement);
 
-                TIntermUnary *negatedCondition = new TIntermUnary(EOpLogicalNot);
-                negatedCondition->setOperand(loop->getCondition());
+                TIntermUnary *negatedCondition =
+                    new TIntermUnary(EOpLogicalNot, loop->getCondition());
 
                 TIntermSelection *innerIf =
                     new TIntermSelection(negatedCondition, breakBlock, nullptr);