aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGen.cc
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-18 06:09:01 +0000
committer_ov4 <ov4@ov4.org>2026-10-18 06:09:01 +0000
commitb17f101cfc75565f9991c856ec62f1e17b0ab104 (patch)
tree6c925f06c45dbaa557a0451cfca33f17be71ec67 /lib/CodeGen/CodeGen.cc
parent16231050058131860f710073c17d3bca7c6637eb (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 'lib/CodeGen/CodeGen.cc')
-rw-r--r--lib/CodeGen/CodeGen.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/CodeGen/CodeGen.cc b/lib/CodeGen/CodeGen.cc
index 61fd837..f7c4de6 100644
--- a/lib/CodeGen/CodeGen.cc
+++ b/lib/CodeGen/CodeGen.cc
@@ -369,6 +369,14 @@ bool CodeGen::marshalCallArgs(const FuncSig &Signature,
const std::vector<std::unique_ptr<ExprAST>> &ArgExprs,
int Line,
std::vector<Value*> &Out) {
+ std::vector<ExprAST*> Args;
+ for (const auto &Arg : ArgExprs) Args.push_back(Arg.get());
+ return marshalCallArgs(Signature, Args, Line, Out);
+}
+
+bool CodeGen::marshalCallArgs(const FuncSig &Signature,
+ const std::vector<ExprAST*> &ArgExprs,
+ int Line, std::vector<Value*> &Out) {
SaveAndRestore<int> Location(DiagnosticLine, Line ? Line : DiagnosticLine);
const FuncSig *Sig = &Signature;
const std::string &Callee = Sig->Name;
@@ -379,7 +387,7 @@ bool CodeGen::marshalCallArgs(const FuncSig &Signature,
for (size_t i = 0; i < ArgExprs.size(); ++i) {
if (i >= Sig->Params.size()) {
- Value *V = emitVariadicArgument(ArgExprs[i].get(), Callee, i + 1);
+ Value *V = emitVariadicArgument(ArgExprs[i], Callee, i + 1);
if (!V) return false;
Out.push_back(V);
continue;
@@ -387,7 +395,7 @@ bool CodeGen::marshalCallArgs(const FuncSig &Signature,
const ParamSig &P = Sig->Params[i];
const std::string &TypeName = P.TypeName;
bool IsByRef = P.IsByRef;
- ExprAST *ArgExpr = ArgExprs[i].get();
+ ExprAST *ArgExpr = ArgExprs[i];
if (P.IsArray) {
if (!Arrays->emitArrayArgument(ArgExpr, P.TypeName, P.Rank, P.DeclaredBounds,