From dd5bbae055fd34ce2e12ef63f8a261c6b15dc83e Mon Sep 17 00:00:00 2001 From: _ov4 Date: Wed, 21 Oct 2026 05:43:35 +0000 Subject: feat(parser): parse TEMPLATE declarations, template ids and parameter packs Co-Authored-By: Claude Opus 5.5 --- lib/CodeGen/CodeGen.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/CodeGen/CodeGen.cc') diff --git a/lib/CodeGen/CodeGen.cc b/lib/CodeGen/CodeGen.cc index 30b6131..641b424 100644 --- a/lib/CodeGen/CodeGen.cc +++ b/lib/CodeGen/CodeGen.cc @@ -6,6 +6,7 @@ #include "cps/ExceptionHandler.h" #include "Builtins.h" #include "cps/TypeAST.h" +#include "cps/TemplateAST.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/Verifier.h" #include @@ -209,7 +210,11 @@ void CodeGen::compile(const std::vector &Sources) { for (const auto &S : Sources[I].Statements) { SaveAndRestore Location(DiagnosticLine, S->getLine()); std::string TypeName; - if (auto *F = dynamic_cast(S.get())) { + if (auto *T = dynamic_cast(S.get())) { + auto *Function = T->getFunction(); + Reserve(T->getName(), Function != nullptr, Function && Function->getProto()->isOverload()); + Templates[T->getName()].push_back({T, I}); + } else if (auto *F = dynamic_cast(S.get())) { Reserve(F->getProto()->getName(), true, F->getProto()->isOverload()); if (sameIdentifier(F->getProto()->getName(), "MAIN")) { if (Entry) reportError("Multiple MAIN definitions in %s and %s", -- cgit v1.3.1-4-g156e