aboutsummaryrefslogtreecommitdiff
path: root/include/cps/CodeGen.h
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-18 06:05:53 +0000
committer_ov4 <ov4@ov4.org>2026-10-18 06:05:53 +0000
commit16231050058131860f710073c17d3bca7c6637eb (patch)
tree1da2ca606f1d513822ccd04b3053d5eee69ac19d /include/cps/CodeGen.h
parent1b0b287629e6e3b6d8eb6182db72b28fd0510574 (diff)
feat(operators): support global binary operator overloads
Resolve exact operand types and preserve declared operator return types. Reject implicit STRING to BOOLEAN conversion at typed expression boundaries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'include/cps/CodeGen.h')
-rw-r--r--include/cps/CodeGen.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/cps/CodeGen.h b/include/cps/CodeGen.h
index d81a82c..30e6d06 100644
--- a/include/cps/CodeGen.h
+++ b/include/cps/CodeGen.h
@@ -155,6 +155,11 @@ class CodeGen {
const std::vector<std::unique_ptr<ExprAST>> &ArgExprs, int Line);
const FuncSig *resolveCall(const std::string &Name,
const std::vector<std::unique_ptr<ExprAST>> &Args);
+ struct OperatorResolution {
+ const FuncSig *Signature = nullptr;
+ bool Ambiguous = false;
+ };
+ OperatorResolution resolveOperator(int Op, const TypeInfo *Left, const TypeInfo *Right = nullptr);
llvm::Value *emitVariadicArgument(ExprAST *Expr, const std::string &Callee, size_t Position);
bool marshalCallArgs(const FuncSig &Signature,
const std::vector<std::unique_ptr<ExprAST>> &ArgExprs,