Don't duplicate symbol type information in AST nodes

Function prototype nodes and symbol nodes already refer to symbols
that have type information, so the type doesn't need to be copied to
the TInterm* AST node classes. Now type is only stored in those AST
node classes that represent other types of expressions. They use
a new TIntermExpression base class for this.

Since now we may use the TType from builtin symbols directly instead
of copying it, building the mangled names of types in the correct
memory pool is also required. The code now realizes the types of
built-in variables when they get added to the symbol table.

BUG=angleproject:2267
TEST=angle_unittests

Change-Id: Ic8d7fc912937cb8abb1e306e58c63bb9c146aae9
Reviewed-on: https://chromium-review.googlesource.com/857005
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/SymbolTable.cpp b/src/compiler/translator/SymbolTable.cpp
index f7d213b..8e4b8b2 100644
--- a/src/compiler/translator/SymbolTable.cpp
+++ b/src/compiler/translator/SymbolTable.cpp
@@ -237,8 +237,7 @@
     TVariable *var = new TVariable(this, name, type, symbolType);
     if (insert(level, var))
     {
-        // Do lazy initialization for struct types, so we allocate to the current scope.
-        if (var->getType().getBasicType() == EbtStruct)
+        if (level <= LAST_BUILTIN_LEVEL)
         {
             var->getType().realize();
         }
@@ -255,7 +254,7 @@
     TVariable *var = new TVariable(this, NewPoolTString(name), type, SymbolType::BuiltIn, ext);
     if (insert(level, var))
     {
-        if (var->getType().getBasicType() == EbtStruct)
+        if (level <= LAST_BUILTIN_LEVEL)
         {
             var->getType().realize();
         }