Fix case_statement/lambda-close-over-variables bug, rename ast_node file to make ast_node:: unambigious, change test_ast to test_compiler and add a little skeleton c_generator file

This commit is contained in:
Nathan Braswell
2016-01-04 00:38:59 -05:00
parent 21a7afe66d
commit 84032eece0
7 changed files with 95 additions and 12 deletions

View File

@@ -1070,6 +1070,12 @@ std::set<NodeTree<ASTData>*> ASTTransformation::findVariablesToClose(NodeTree<AS
}
return closed;
}
if (stat->getDataRef()->type == case_statement) {
// don't try to close over the variant specifier itself, only its statement child
auto recClosed = findVariablesToClose(func, stat->getChildren().back(), scope);
closed.insert(recClosed.begin(), recClosed.end());
return closed;
}
if (stat->getDataRef()->type == function_call && (stat->getDataRef()->symbol.getName() == "." || stat->getDataRef()->symbol.getName() == "->")) {
// only search on the left side of access operators like . and ->
auto recClosed = findVariablesToClose(func, stat->getChildren()[1], scope);