Fix an issue with handling an error case inside ValidateSwitch
In case a condition with a wrong type is given to a case statement, it
generates an error but the compiler recovers. This caused ValidateSwitch
to assert. Fix this.
BUG=angle:921
Change-Id: I7949798cab923c2b168817471896470c6c611878
Reviewed-on: https://chromium-review.googlesource.com/254080
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/ValidateSwitch.cpp b/src/compiler/translator/ValidateSwitch.cpp
index 421285d..9a4ed33 100644
--- a/src/compiler/translator/ValidateSwitch.cpp
+++ b/src/compiler/translator/ValidateSwitch.cpp
@@ -131,9 +131,8 @@
mCasesSigned.insert(iConst);
}
}
- else
+ else if (conditionType == EbtUInt)
{
- ASSERT(conditionType == EbtUInt);
unsigned int uConst = condition->getUConst(0);
if (mCasesUnsigned.find(uConst) != mCasesUnsigned.end())
{
@@ -144,8 +143,9 @@
{
mCasesUnsigned.insert(uConst);
}
-
}
+ // Other types are possible only in error cases, where the error has already been generated
+ // when parsing the case statement.
}
// Don't traverse the condition of the case statement
return false;