Disallow local function prototypes

Function prototypes should not be allowed inside other functions
according to ESSL 3.00.4 section 4.2.4.

BUG=angleproject:1068
TEST=angle_unittests,
     dEQP-GLES*.functional.shaders.functions.invalid.local_function_proto*

Change-Id: I54160da4d49b92a6cd7cbee020e67733963d4e10
Reviewed-on: https://chromium-review.googlesource.com/320091
Tryjob-Request: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp
index 89317e8..235351c 100644
--- a/src/compiler/translator/ParseContext.cpp
+++ b/src/compiler/translator/ParseContext.cpp
@@ -1968,6 +1968,14 @@
     prototype->setOp(EOpPrototype);
 
     symbolTable.pop();
+
+    if (!symbolTable.atGlobalLevel())
+    {
+        // ESSL 3.00.4 section 4.2.4.
+        error(location, "local function prototype declarations are not allowed", "function");
+        recover();
+    }
+
     return prototype;
 }