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:
parent
e25cd0447d
commit
fb5f7eadfa
5 changed files with 104 additions and 77 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue