Replace setArray function in TPublicType with functions from TType

Having only one way of setting or clearing arrayness of types clarifies
code dealing with arrays.

TEST=angle_unittests
BUG=angleproject:941

Change-Id: I98cb7c44fd66440c9de8b4c6c4a02827e9300db7
Reviewed-on: https://chromium-review.googlesource.com/264361
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/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp
index f162e42..a181e7e 100644
--- a/src/compiler/translator/ParseContext.cpp
+++ b/src/compiler/translator/ParseContext.cpp
@@ -1238,7 +1238,7 @@
     {
         error(typeSpecifier.line, "not supported", "first-class array");
         recover();
-        returnType.setArray(false);
+        returnType.clearArrayness();
     }
 
     if (shaderVersion < 300)
@@ -1347,7 +1347,7 @@
     }
     else
     {
-        arrayType.setArray(true, size);
+        arrayType.setArraySize(size);
     }
 
     TIntermSymbol* symbol = intermediate.addSymbol(0, identifier, TType(arrayType), identifierLocation);
@@ -1468,7 +1468,7 @@
         if (arraySizeErrorCheck(arrayLocation, indexExpression, size))
             recover();
         TPublicType arrayType(publicType);
-        arrayType.setArray(true, size);
+        arrayType.setArraySize(size);
         TVariable* variable = NULL;
         if (arrayErrorCheck(arrayLocation, identifier, arrayType, variable))
             recover();
diff --git a/src/compiler/translator/Types.h b/src/compiler/translator/Types.h
index 044f22c..1bd5a39 100644
--- a/src/compiler/translator/Types.h
+++ b/src/compiler/translator/Types.h
@@ -553,11 +553,16 @@
         secondarySize = r;
     }
 
-    void setArray(bool a, int s = 0)
+    void setArraySize(int s)
     {
-        array = a;
+        array = true;
         arraySize = s;
     }
+    void clearArrayness()
+    {
+        array = false;
+        arraySize = 0;
+    }
 
     bool isStructureContainingArrays() const
     {
diff --git a/src/compiler/translator/glslang.y b/src/compiler/translator/glslang.y
index 34f1cf9..bd184c4 100644
--- a/src/compiler/translator/glslang.y
+++ b/src/compiler/translator/glslang.y
@@ -807,7 +807,7 @@
         int size;
         if (context->arraySizeErrorCheck(@3, $4, size))
             context->recover();
-        $1.setArray(true, size);
+        $1.setArraySize(size);
 
         TType* type = new TType($1);
         TParameter param = { $2.string, type };
@@ -930,7 +930,7 @@
         if ($1.array) {
             ES3_ONLY("[]", @1, "first-class-array");
             if (context->shaderVersion != 300) {
-                $1.setArray(false);
+                $1.clearArrayness();
             }
         }
     }
@@ -1120,7 +1120,7 @@
             int size;
             if (context->arraySizeErrorCheck(@2, $3, size))
                 context->recover();
-            $$.setArray(true, size);
+            $$.setArraySize(size);
         }
     }
     ;
diff --git a/src/compiler/translator/glslang_tab.cpp b/src/compiler/translator/glslang_tab.cpp
index a527d40..b0589ea 100644
--- a/src/compiler/translator/glslang_tab.cpp
+++ b/src/compiler/translator/glslang_tab.cpp
@@ -3277,7 +3277,7 @@
         int size;
         if (context->arraySizeErrorCheck((yylsp[-2]), (yyvsp[-1].interm.intermTypedNode), size))
             context->recover();
-        (yyvsp[-4].interm.type).setArray(true, size);
+        (yyvsp[-4].interm.type).setArraySize(size);
 
         TType* type = new TType((yyvsp[-4].interm.type));
         TParameter param = { (yyvsp[-3].lex).string, type };
@@ -3471,7 +3471,7 @@
         if ((yyvsp[0].interm.type).array) {
             ES3_ONLY("[]", (yylsp[0]), "first-class-array");
             if (context->shaderVersion != 300) {
-                (yyvsp[0].interm.type).setArray(false);
+                (yyvsp[0].interm.type).clearArrayness();
             }
         }
     }
@@ -3786,7 +3786,7 @@
             int size;
             if (context->arraySizeErrorCheck((yylsp[-2]), (yyvsp[-1].interm.intermTypedNode), size))
                 context->recover();
-            (yyval.interm.type).setArray(true, size);
+            (yyval.interm.type).setArraySize(size);
         }
     }