Disallow length being called on expressions with side effects

ESSL 3.00 definition of expressions does not include calling length on
anything other than array names, so enforce this restriction in the
parser.

TEST=WebGL 2 conformance tests
BUG=angleproject:972

Change-Id: I893d3c468ff21cb419b3239738f2a41834298cf2
Reviewed-on: https://chromium-review.googlesource.com/266992
Reviewed-by: Olli Etuaho <oetuaho@nvidia.com>
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp
index 014a9b2..9b9ca3a 100644
--- a/src/compiler/translator/ParseContext.cpp
+++ b/src/compiler/translator/ParseContext.cpp
@@ -3168,12 +3168,17 @@
         else
         {
             arraySize = typedThis->getArraySize();
-            if (typedThis->hasSideEffects())
+            if (typedThis->getAsSymbolNode() == nullptr)
             {
-                // This code path can be hit with an expression like this:
+                // This code path can be hit with expressions like these:
                 // (a = b).length()
-                // where a and b are both arrays.
-                UNIMPLEMENTED();
+                // (func()).length()
+                // (int[3](0, 1, 2)).length()
+                // ESSL 3.00 section 5.9 defines expressions so that this is not actually a valid expression.
+                // It allows "An array name with the length method applied" in contrast to GLSL 4.4 spec section 5.9
+                // which allows "An array, vector or matrix expression with the length method applied".
+                error(loc, "length can only be called on array names, not on array expressions", "length");
+                recover();
             }
         }
         unionArray->setIConst(arraySize);