Commit c8716df9 by Olli Etuaho

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/254080Reviewed-by: 's avatarZhenyao Mo <zmo@chromium.org> Tested-by: 's avatarOlli Etuaho <oetuaho@nvidia.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent eea095e1
...@@ -131,9 +131,8 @@ bool ValidateSwitch::visitCase(Visit, TIntermCase *node) ...@@ -131,9 +131,8 @@ bool ValidateSwitch::visitCase(Visit, TIntermCase *node)
mCasesSigned.insert(iConst); mCasesSigned.insert(iConst);
} }
} }
else else if (conditionType == EbtUInt)
{ {
ASSERT(conditionType == EbtUInt);
unsigned int uConst = condition->getUConst(0); unsigned int uConst = condition->getUConst(0);
if (mCasesUnsigned.find(uConst) != mCasesUnsigned.end()) if (mCasesUnsigned.find(uConst) != mCasesUnsigned.end())
{ {
...@@ -144,8 +143,9 @@ bool ValidateSwitch::visitCase(Visit, TIntermCase *node) ...@@ -144,8 +143,9 @@ bool ValidateSwitch::visitCase(Visit, TIntermCase *node)
{ {
mCasesUnsigned.insert(uConst); 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 // Don't traverse the condition of the case statement
return false; return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment