From b17f101cfc75565f9991c856ec62f1e17b0ab104 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Sun, 18 Oct 2026 06:09:01 +0000 Subject: feat(operators): add member and unary overloads with explicit calls Select member and global candidates together, enforce private access, and reuse argument marshalling. Materialize temporary receivers for chaining and register them for the existing object cleanup mechanism. Co-Authored-By: Claude Opus 5.5 --- include/cps/CodeGen.h | 7 +++++++ include/cps/Operator.h | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/cps/CodeGen.h b/include/cps/CodeGen.h index 30e6d06..9b2d6c5 100644 --- a/include/cps/CodeGen.h +++ b/include/cps/CodeGen.h @@ -160,11 +160,18 @@ class CodeGen { bool Ambiguous = false; }; OperatorResolution resolveOperator(int Op, const TypeInfo *Left, const TypeInfo *Right = nullptr); + bool checkOperatorAccess(const FuncSig &Signature); + llvm::Value *materializeOperatorReceiver(llvm::Value *Value, const TypeInfo *Type); + llvm::Value *emitOperatorCall(const FuncSig &Signature, ExprAST *Left, ExprAST *Right = nullptr); + llvm::Value *emitOperatorValues(const FuncSig &Signature, llvm::Value *Left, + const TypeInfo *LeftType, llvm::Value *Right); llvm::Value *emitVariadicArgument(ExprAST *Expr, const std::string &Callee, size_t Position); bool marshalCallArgs(const FuncSig &Signature, const std::vector> &ArgExprs, int Line, std::vector &Out); + bool marshalCallArgs(const FuncSig &Signature, const std::vector &ArgExprs, + int Line, std::vector &Out); llvm::Value *symbolAddress(const SymbolInfo &Info); void emitAssignment(const LValueInfo &Target, ExprAST *Expr, const SymbolInfo *Symbol = nullptr); diff --git a/include/cps/Operator.h b/include/cps/Operator.h index 7cbb5d9..304793e 100644 --- a/include/cps/Operator.h +++ b/include/cps/Operator.h @@ -22,7 +22,7 @@ inline std::string operatorSpelling(int Op) { } inline std::string operatorName(int Op) { - return "OPERATOR" + operatorSpelling(Op); + return "OPERATOR " + operatorSpelling(Op); } } // namespace cps -- cgit v1.3.1-4-g156e