Refactor unary math operator handling to clarify responsibilities

Shuffle the code around so that each part has a clear responsibility:
IntermUnary::promote is responsible for setting the return type of the
node, Intermediate::addUnaryMath is responsible for creating the node
object, and ParseContext::createUnaryMath is responsible for validating
the operand type.

This removes duplicated bool type check for logical not.

BUG=angleproject:952
TEST=angle_unittests, WebGL conformance tests

Change-Id: I9f5a0abb6434ad2730441ea9199ec3f5382ebcda
Reviewed-on: https://chromium-review.googlesource.com/262415
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/Intermediate.cpp b/src/compiler/translator/Intermediate.cpp
index 12fb5bd..b72a2bf 100644
--- a/src/compiler/translator/Intermediate.cpp
+++ b/src/compiler/translator/Intermediate.cpp
@@ -139,29 +139,7 @@
     TIntermUnary *node = new TIntermUnary(op);
     node->setLine(line);
     node->setOperand(child);
-
-    if (!node->promote(mInfoSink))
-        return 0;
-
-    switch (op)
-    {
-      case EOpFloatBitsToInt:
-      case EOpFloatBitsToUint:
-      case EOpIntBitsToFloat:
-      case EOpUintBitsToFloat:
-      case EOpPackSnorm2x16:
-      case EOpPackUnorm2x16:
-      case EOpPackHalf2x16:
-      case EOpUnpackSnorm2x16:
-      case EOpUnpackUnorm2x16:
-        node->getTypePointer()->setPrecision(EbpHigh);
-        break;
-      case EOpUnpackHalf2x16:
-        node->getTypePointer()->setPrecision(EbpMedium);
-        break;
-      default:
-        break;
-    }
+    node->promote();
 
     if (childTempConstant)
     {