make grammer/parser use simple adts, fix it so adt literals aren't closed over by accident

This commit is contained in:
Nathan Braswell
2015-08-30 01:53:11 -04:00
parent 5f3f3e5a66
commit 13c6044193
4 changed files with 39 additions and 29 deletions

View File

@@ -1002,7 +1002,10 @@ std::set<NodeTree<ASTData>*> ASTTransformation::findVariablesToClose(NodeTree<AS
closed.insert(recClosed.begin(), recClosed.end());
return closed;
}
if (stat->getDataRef()->type == identifier && !inScopeChain(stat, func))
// if it's an identifier and not in the scope chain, and isn't an enum name
if (stat->getDataRef()->type == identifier && !inScopeChain(stat, func) &&
(!stat->getDataRef()->valueType->typeDefinition ||
stat->getDataRef()->valueType->typeDefinition->getDataRef()->type != adt_def) )
closed.insert(stat);
for (auto child: stat->getChildren()) {
auto recClosed = findVariablesToClose(func, child, scope);