From 6350f93f243f8c8f69135b9aa9e6df0855192c94 Mon Sep 17 00:00:00 2001 From: Nathan Braswell Date: Wed, 21 May 2014 01:20:39 -0400 Subject: [PATCH] Fixed the recursion bug. 8/10 tests pass now, remaining need to fix define order and CGenerator order --- src/ASTTransformation.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ASTTransformation.cpp b/src/ASTTransformation.cpp index a97d7dc..94ac037 100644 --- a/src/ASTTransformation.cpp +++ b/src/ASTTransformation.cpp @@ -476,9 +476,10 @@ NodeTree* ASTTransformation::scopeLookup(NodeTree* scope, std: return *i; std::vector*> 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 - //non-instantiated template (which would not have a body node, which is why we subtract one) - if (types.size() != ((children.size() > 0 && (*i)->getDataRef()->valueType->baseType != template_type ) ? children.size()-1 : children.size())) { + //We subtract one from the children to get the type size only if there is at least one child AND + // the last node is actually a body node, as it may not have been generated yet if we're in the body + //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: "; for (auto j : types) std::cout << j.toString() << " ";