Improve robustness for symbol downcasts by moving to a "getAs" infrastructure and doing more error checking.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@20609 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-02-14 19:02:23 +00:00
parent e25cd0447d
commit fb5f7eadfa
5 changed files with 104 additions and 77 deletions

View file

@ -541,11 +541,12 @@ int PaReservedWord()
int PaIdentOrType(TString& id, TParseContext& parseContextLocal, TSymbol*& symbol)
{
symbol = parseContextLocal.symbolTable.find(id);
if (parseContextLocal.lexAfterType == false && symbol && symbol->isVariable()) {
TVariable* variable = static_cast<TVariable*>(symbol);
if (variable->isUserType()) {
parseContextLocal.lexAfterType = true;
return TYPE_NAME;
if (parseContextLocal.lexAfterType == false && symbol) {
if (TVariable* variable = symbol->getAsVariable()) {
if (variable->isUserType()) {
parseContextLocal.lexAfterType = true;
return TYPE_NAME;
}
}
}