Fixed the recursion bug. 8/10 tests pass now, remaining need to fix define order and CGenerator order

This commit is contained in:
Nathan Braswell
2014-05-21 01:20:39 -04:00
parent 17b80d4102
commit 6350f93f24

View File

@@ -476,9 +476,10 @@ NodeTree<ASTData>* ASTTransformation::scopeLookup(NodeTree<ASTData>* scope, std:
return *i; return *i;
std::vector<NodeTree<ASTData>*> children = (*i)->getChildren(); std::vector<NodeTree<ASTData>*> children = (*i)->getChildren();
//We subtract one from the children to get the type size only if there is at least one child AND this function is not a //We subtract one from the children to get the type size only if there is at least one child AND
//non-instantiated template (which would not have a body node, which is why we subtract one) // the last node is actually a body node, as it may not have been generated yet if we're in the body
if (types.size() != ((children.size() > 0 && (*i)->getDataRef()->valueType->baseType != template_type ) ? children.size()-1 : children.size())) { //and this function is recursive or if this is a non-instantiated template function
if (types.size() != ((children.size() > 0 && children[children.size()-1]->getDataRef()->type == code_block) ? children.size()-1 : children.size())) {
std::cout << "Type sizes do not match between two " << lookup << "(" << types.size() << "," << ((children.size() > 0) ? children.size()-1 : 0) << "), types are: "; std::cout << "Type sizes do not match between two " << lookup << "(" << types.size() << "," << ((children.size() > 0) ? children.size()-1 : 0) << "), types are: ";
for (auto j : types) for (auto j : types)
std::cout << j.toString() << " "; std::cout << j.toString() << " ";