Front-end: Add specialization-constant subtrees for const variables/symbols.

This commit is contained in:
John Kessenich 2016-03-20 16:46:00 -06:00
parent 7cc0e2896e
commit a5845766e0
8 changed files with 61 additions and 23 deletions

View file

@ -252,11 +252,14 @@ TVariable::TVariable(const TVariable& copyOf) : TSymbol(copyOf)
if (copyOf.numExtensions != 0)
setExtensions(copyOf.numExtensions, copyOf.extensions);
if (! copyOf.unionArray.empty()) {
if (! copyOf.constArray.empty()) {
assert(! copyOf.type.isStruct());
TConstUnionArray newArray(copyOf.unionArray, 0, copyOf.unionArray.size());
unionArray = newArray;
TConstUnionArray newArray(copyOf.constArray, 0, copyOf.constArray.size());
constArray = newArray;
}
// don't support specialization-constant subtrees in cloned tables
constSubtree = nullptr;
}
TVariable* TVariable::clone() const