Generalize the symbol hierarchy to transparently handle anonymous-block members better.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23469 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
4c70685382
commit
9d30218fb6
8 changed files with 217 additions and 155 deletions
|
|
@ -885,6 +885,11 @@ void TIntermediate::addSymbolLinkageNodes(TIntermAggregate*& linkage, EShLanguag
|
|||
treeRoot = growAggregate(treeRoot, linkage);
|
||||
}
|
||||
|
||||
//
|
||||
// Add the given name or symbol to the list of nodes at the end of the tree used
|
||||
// for link-time checking and external linkage.
|
||||
//
|
||||
|
||||
void TIntermediate::addSymbolLinkageNode(TIntermAggregate*& linkage, TSymbolTable& symbolTable, const TString& name)
|
||||
{
|
||||
TSymbol* symbol = symbolTable.find(name);
|
||||
|
|
@ -892,10 +897,16 @@ void TIntermediate::addSymbolLinkageNode(TIntermAggregate*& linkage, TSymbolTabl
|
|||
addSymbolLinkageNode(linkage, *symbol->getAsVariable());
|
||||
}
|
||||
|
||||
void TIntermediate::addSymbolLinkageNode(TIntermAggregate*& linkage, const TVariable& variable)
|
||||
void TIntermediate::addSymbolLinkageNode(TIntermAggregate*& linkage, const TSymbol& symbol)
|
||||
{
|
||||
TIntermSymbol* node = new TIntermSymbol(variable.getUniqueId(), variable.getName(), variable.getType());
|
||||
node->setConstArray(variable.getConstArray());
|
||||
const TVariable* variable = symbol.getAsVariable();
|
||||
if (! variable) {
|
||||
// This must be a member of an anonymous block, and we need to add the whole block
|
||||
const TAnonMember* anon = symbol.getAsAnonMember();
|
||||
variable = &anon->getAnonContainer();
|
||||
}
|
||||
TIntermSymbol* node = new TIntermSymbol(variable->getUniqueId(), variable->getName(), variable->getType());
|
||||
node->setConstArray(variable->getConstArray());
|
||||
linkage = growAggregate(linkage, node);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue