diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-24 18:04:52 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-24 18:06:18 +0000 |
| commit | 92dc80ad6616f1fef72cfef1ae120e4fb5b41146 (patch) | |
| tree | 37cb449eaa832739ede6fe8bdc280aa995394882 /include | |
| parent | 0900667401415a0914b8a1510543c7c7eaf32e53 (diff) | |
feat(operator): select operator overloads by the expected result type
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'include')
| -rw-r--r-- | include/cps/CodeGen.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/include/cps/CodeGen.h b/include/cps/CodeGen.h index 99630ec..45660b8 100644 --- a/include/cps/CodeGen.h +++ b/include/cps/CodeGen.h @@ -184,7 +184,8 @@ class CodeGen { const TypeInfo *Target); llvm::Value *emitCast(CastExprAST *Cast); llvm::Value *emitBinaryOp(int Op, llvm::Value *L, const TypeInfo *LT, - llvm::Value *R, const TypeInfo *RT, int Line); + llvm::Value *R, const TypeInfo *RT, int Line, + const ResultContext *Context = nullptr); llvm::Value *emitCBinaryOp(int Op, llvm::Value *L, const TypeInfo *Left, llvm::Value *R, const TypeInfo *Right, int Line); void emitCOutput(llvm::Value *Val, const TypeInfo *Info, bool AppendNewline); @@ -222,8 +223,10 @@ class CodeGen { struct OperatorResolution { const FuncSig *Signature = nullptr; bool Ambiguous = false; + bool WrongResult = false; }; - OperatorResolution resolveOperator(int Op, const TypeInfo *Left, const TypeInfo *Right = nullptr); + OperatorResolution resolveOperator(int Op, const TypeInfo *Left, const TypeInfo *Right = nullptr, + const ResultContext *Context = 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); |
