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/RemovePow.cpp b/src/compiler/translator/RemovePow.cpp
index ba50575..4b0fe69 100644
--- a/src/compiler/translator/RemovePow.cpp
+++ b/src/compiler/translator/RemovePow.cpp
@@ -55,19 +55,15 @@
         TIntermTyped *x = node->getSequence()->at(0)->getAsTyped();
         TIntermTyped *y = node->getSequence()->at(1)->getAsTyped();
 
-        TIntermUnary *log = new TIntermUnary(EOpLog2);
-        log->setOperand(x);
+        TIntermUnary *log = new TIntermUnary(EOpLog2, x);
         log->setLine(node->getLine());
-        log->setType(x->getType());
 
         TOperator op       = TIntermBinary::GetMulOpBasedOnOperands(y->getType(), log->getType());
         TIntermBinary *mul = new TIntermBinary(op, y, log);
         mul->setLine(node->getLine());
 
-        TIntermUnary *exp = new TIntermUnary(EOpExp2);
-        exp->setOperand(mul);
+        TIntermUnary *exp = new TIntermUnary(EOpExp2, mul);
         exp->setLine(node->getLine());
-        exp->setType(node->getType());
 
         queueReplacement(node, exp, OriginalNode::IS_DROPPED);