Issue #39: Prevent problem of inserting a zero-length symbol after cascading errors.
This commit is contained in:
parent
aead93aafd
commit
91b977e172
1 changed files with 7 additions and 6 deletions
|
|
@ -1626,12 +1626,13 @@ void TParseContext::variableCheck(TIntermTyped*& nodePtr)
|
||||||
error(symbol->getLoc(), "undeclared identifier", symbol->getName().c_str(), "");
|
error(symbol->getLoc(), "undeclared identifier", symbol->getName().c_str(), "");
|
||||||
|
|
||||||
// Add to symbol table to prevent future error messages on the same name
|
// Add to symbol table to prevent future error messages on the same name
|
||||||
|
if (symbol->getName().size() > 0) {
|
||||||
TVariable* fakeVariable = new TVariable(&symbol->getName(), TType(EbtFloat));
|
TVariable* fakeVariable = new TVariable(&symbol->getName(), TType(EbtFloat));
|
||||||
symbolTable.insert(*fakeVariable);
|
symbolTable.insert(*fakeVariable);
|
||||||
|
|
||||||
// substitute a symbol node for this new variable
|
// substitute a symbol node for this new variable
|
||||||
nodePtr = intermediate.addSymbol(*fakeVariable, symbol->getLoc());
|
nodePtr = intermediate.addSymbol(*fakeVariable, symbol->getLoc());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (symbol->getQualifier().storage) {
|
switch (symbol->getQualifier().storage) {
|
||||||
case EvqPointCoord:
|
case EvqPointCoord:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue