diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-18 06:09:01 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-18 06:09:01 +0000 |
| commit | b17f101cfc75565f9991c856ec62f1e17b0ab104 (patch) | |
| tree | 6c925f06c45dbaa557a0451cfca33f17be71ec67 /include/cps | |
| parent | 16231050058131860f710073c17d3bca7c6637eb (diff) | |
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 <noreply@anthropic.com>
Diffstat (limited to 'include/cps')
| -rw-r--r-- | include/cps/CodeGen.h | 7 | ||||
| -rw-r--r-- | include/cps/Operator.h | 2 |
2 files changed, 8 insertions, 1 deletions
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<std::unique_ptr<ExprAST>> &ArgExprs, int Line, std::vector<llvm::Value*> &Out); + bool marshalCallArgs(const FuncSig &Signature, const std::vector<ExprAST*> &ArgExprs, + int Line, std::vector<llvm::Value*> &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 |
