Commit 78a5a0d7 by John Kessenich

Front end: Prevent use of a block name, which has no other use in a shader.

parent 68965c0f
...@@ -448,8 +448,16 @@ TIntermTyped* TParseContext::handleVariable(TSourceLoc loc, TSymbol* symbol, con ...@@ -448,8 +448,16 @@ TIntermTyped* TParseContext::handleVariable(TSourceLoc loc, TSymbol* symbol, con
// The symbol table search was done in the lexical phase. // The symbol table search was done in the lexical phase.
// See if it was a variable. // See if it was a variable.
variable = symbol ? symbol->getAsVariable() : 0; variable = symbol ? symbol->getAsVariable() : 0;
if (symbol && ! variable) if (variable) {
if ((variable->getType().getBasicType() == EbtBlock ||
variable->getType().getBasicType() == EbtStruct) && variable->getType().getStruct() == nullptr) {
error(loc, "cannot be used (maybe an instance name is needed)", string->c_str(), "");
variable = nullptr;
}
} else {
if (symbol)
error(loc, "variable name expected", string->c_str(), ""); error(loc, "variable name expected", string->c_str(), "");
}
// Recovery, if it wasn't found or was not a variable. // Recovery, if it wasn't found or was not a variable.
if (! variable) if (! variable)
......
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