aboutsummaryrefslogtreecommitdiff
path: root/include/cps/FunctionAST.h
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-17 09:16:22 +0000
committer_ov4 <ov4@ov4.org>2026-10-17 09:16:22 +0000
commit64aa538142148faf06b9a3c71907eacee04cd49d (patch)
tree8c8b572d391a5cf5c269fd5c2484e1ba82ed5fcb /include/cps/FunctionAST.h
parent39e50838bd12057d9305575f50c63990984df01a (diff)
feat(codegen): FUNCTION MAIN entry point
Invoke the internal entry function through the generated exception handler and truncate its INTEGER result to the process exit status. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'include/cps/FunctionAST.h')
-rw-r--r--include/cps/FunctionAST.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/cps/FunctionAST.h b/include/cps/FunctionAST.h
index 9b2d49b..4dfe908 100644
--- a/include/cps/FunctionAST.h
+++ b/include/cps/FunctionAST.h
@@ -1,5 +1,6 @@
#pragma once
#include "cps/AST.h"
+#include "cps/Identifier.h"
#include <cstdint>
#include <vector>
#include <string>
@@ -46,7 +47,10 @@ public:
bool isExternal() const { return IsExternal; }
const std::string &getOwnerClass() const { return OwnerClass; }
bool isPublic() const { return IsPublic; }
- std::string getLinkName() const { return OwnerClass.empty() ? Name : OwnerClass + "." + Name; }
+ std::string getLinkName() const {
+ if (!OwnerClass.empty()) return OwnerClass + "." + Name;
+ return sameIdentifier(Name, "MAIN") ? "__cps_main" : Name;
+ }
};
class FunctionDefAST : public StmtAST {