Remove code related to redeclaration of arrays
It should not be possible to redeclare arrays. This seems to be another
thing left over from earlier erroneous code which allowed declaring
unsized arrays.
TEST=angle_unittests
BUG=angleproject:941
Change-Id: I711565230b35df077f268cec6fdeac6c4c03b4cd
Reviewed-on: https://chromium-review.googlesource.com/264672
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 03cccf0..4387011 100644
--- a/src/compiler/translator/ParseContext.cpp
+++ b/src/compiler/translator/ParseContext.cpp
@@ -781,8 +781,8 @@
}
//
-// Do all the semantic checking for declaring an array, with and
-// without a size, and make the right changes to the symbol table.
+// Do all the semantic checking for declaring an array,
+// and make the right changes to the symbol table.
//
// size == 0 means no specified size.
//
@@ -790,11 +790,6 @@
//
bool TParseContext::arrayErrorCheck(const TSourceLoc& line, const TString& identifier, const TPublicType &type, TVariable*& variable)
{
- //
- // Don't check for reserved word use until after we know it's not in the symbol table,
- // because reserved arrays can be redeclared.
- //
-
bool builtIn = false;
bool sameScope = false;
TSymbol* symbol = symbolTable.find(identifier, 0, &builtIn, &sameScope);
@@ -827,30 +822,12 @@
error(line, "INTERNAL ERROR inserting new symbol", identifier.c_str());
return true;
}
- } else {
- if (! symbol->isVariable()) {
- error(line, "variable expected", identifier.c_str());
- return true;
- }
-
- variable = static_cast<TVariable*>(symbol);
- if (! variable->getType().isArray()) {
- error(line, "redeclaring non-array as array", identifier.c_str());
- return true;
- }
- if (variable->getType().getArraySize() > 0) {
- error(line, "redeclaration of array with size", identifier.c_str());
- return true;
- }
-
- if (! variable->getType().sameElementType(TType(type))) {
- error(line, "redeclaration of array with a different type", identifier.c_str());
- return true;
- }
-
- if (type.arraySize)
- variable->getType().setArraySize(type.arraySize);
- }
+ }
+ else
+ {
+ error(line, "redeclaration of an array", identifier.c_str());
+ return true;
+ }
if (voidErrorCheck(line, identifier, type))
return true;