aboutsummaryrefslogtreecommitdiff
path: root/include/cps/FunctionAST.h
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-21 05:43:35 +0000
committer_ov4 <ov4@ov4.org>2026-10-21 05:43:35 +0000
commitdd5bbae055fd34ce2e12ef63f8a261c6b15dc83e (patch)
tree757e367daacf92c50148eb42d7bda97ba33ed3fb /include/cps/FunctionAST.h
parentc682f983b0dce3acba76d1f08719a26b9c52c5ec (diff)
feat(parser): parse TEMPLATE declarations, template ids and parameter packs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'include/cps/FunctionAST.h')
-rw-r--r--include/cps/FunctionAST.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/include/cps/FunctionAST.h b/include/cps/FunctionAST.h
index 90ef5c4..9188015 100644
--- a/include/cps/FunctionAST.h
+++ b/include/cps/FunctionAST.h
@@ -23,6 +23,7 @@ struct ParamDecl {
int Rank = 0; // 0 = scalar
std::vector<std::pair<int64_t, int64_t>> DeclaredBounds;
int Line = 0;
+ bool IsPack = false;
};
class PrototypeAST {
@@ -87,25 +88,31 @@ public:
class CallExprAST : public ExprAST {
std::string Callee;
std::vector<std::unique_ptr<ExprAST>> Args;
+ std::vector<std::string> TemplateArgs;
public:
- CallExprAST(const std::string &Callee, std::vector<std::unique_ptr<ExprAST>> Args, int Line)
- : ExprAST(Line), Callee(Callee), Args(std::move(Args)) {}
+ CallExprAST(const std::string &Callee, std::vector<std::unique_ptr<ExprAST>> Args, int Line,
+ std::vector<std::string> TemplateArgs = {})
+ : ExprAST(Line), Callee(Callee), Args(std::move(Args)), TemplateArgs(std::move(TemplateArgs)) {}
const std::string &getCallee() const { return Callee; }
const std::vector<std::unique_ptr<ExprAST>> &getArgs() const { return Args; }
+ const std::vector<std::string> &getTemplateArgs() const { return TemplateArgs; }
};
class CallStmtAST : public StmtAST {
std::string Callee;
std::vector<std::unique_ptr<ExprAST>> Args;
+ std::vector<std::string> TemplateArgs;
public:
- CallStmtAST(const std::string &Callee, std::vector<std::unique_ptr<ExprAST>> Args, int Line)
- : StmtAST(Line), Callee(Callee), Args(std::move(Args)) {}
+ CallStmtAST(const std::string &Callee, std::vector<std::unique_ptr<ExprAST>> Args, int Line,
+ std::vector<std::string> TemplateArgs = {})
+ : StmtAST(Line), Callee(Callee), Args(std::move(Args)), TemplateArgs(std::move(TemplateArgs)) {}
const std::string &getCallee() const { return Callee; }
const std::vector<std::unique_ptr<ExprAST>> &getArgs() const { return Args; }
+ const std::vector<std::string> &getTemplateArgs() const { return TemplateArgs; }
};