Commit 91b977e1 by John Kessenich

Issue #39: Prevent problem of inserting a zero-length symbol after cascading errors.

parent aead93aa
...@@ -365,7 +365,7 @@ void C_DECL TParseContext::error(TSourceLoc loc, const char* szReason, const cha ...@@ -365,7 +365,7 @@ void C_DECL TParseContext::error(TSourceLoc loc, const char* szReason, const cha
const char* szExtraInfoFormat, ...) const char* szExtraInfoFormat, ...)
{ {
if (messages & EShMsgOnlyPreprocessor) if (messages & EShMsgOnlyPreprocessor)
return; return;
va_list args; va_list args;
va_start(args, szExtraInfoFormat); va_start(args, szExtraInfoFormat);
outputMessage(loc, szReason, szToken, szExtraInfoFormat, EPrefixError, args); outputMessage(loc, szReason, szToken, szExtraInfoFormat, EPrefixError, args);
...@@ -1626,12 +1626,13 @@ void TParseContext::variableCheck(TIntermTyped*& nodePtr) ...@@ -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));
symbolTable.insert(*fakeVariable);
TVariable* fakeVariable = new TVariable(&symbol->getName(), TType(EbtFloat)); // substitute a symbol node for this new variable
symbolTable.insert(*fakeVariable); nodePtr = intermediate.addSymbol(*fakeVariable, symbol->getLoc());
}
// substitute a symbol node for this new variable
nodePtr = intermediate.addSymbol(*fakeVariable, symbol->getLoc());
} else { } else {
switch (symbol->getQualifier().storage) { switch (symbol->getQualifier().storage) {
case EvqPointCoord: case EvqPointCoord:
......
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