diff --git a/include/.ASTTransformation.h.swp b/include/.ASTTransformation.h.swp deleted file mode 100644 index 1fab7b1..0000000 Binary files a/include/.ASTTransformation.h.swp and /dev/null differ diff --git a/src/.ASTTransformation.cpp.swp b/src/.ASTTransformation.cpp.swp deleted file mode 100644 index 237ab0d..0000000 Binary files a/src/.ASTTransformation.cpp.swp and /dev/null differ diff --git a/src/ASTTransformation.cpp b/src/ASTTransformation.cpp index a5c8570..cdc2c3c 100644 --- a/src/ASTTransformation.cpp +++ b/src/ASTTransformation.cpp @@ -212,6 +212,18 @@ void ASTTransformation::fourthPass(NodeTree* ast, NodeTree* par topScope = ast; //Top scope is maintained for templates, which need to add themselves to the top scope from where ever they are instantiated std::vector*> children = parseTree->getChildren(); + //First copy unfinished class templates into a new list and do them before anything else, so we know exactly which ones we need to do. + std::vector*> classTemplates; + for (auto i : ast->getDataRef()->scope) + if (i.second[0]->getDataRef()->type == type_def && i.second[0]->getDataRef()->valueType->baseType == template_type) + classTemplates.push_back(i.second[0]); + for (auto i : classTemplates) { + Type* classTemplateType = i->getDataRef()->valueType; + for (NodeTree* j : classTemplateType->templateDefinition->getChildren()) + if (j->getDataRef()->getName() == "function") + fourthPassFunction(j, seachScopeForFunctionDef(i, j, classTemplateType->templateTypeReplacement), classTemplateType->templateTypeReplacement); //do member method + } + //Go through and finish both regular functions and class methods //Note that this pass can instantiate class AND function templates for (NodeTree* i : children) {