From 0900667401415a0914b8a1510543c7c7eaf32e53 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Sat, 24 Oct 2026 18:01:36 +0000 Subject: feat(overload): select overloads by return type as well as parameters Co-Authored-By: Claude Opus 5.5 --- lib/CodeGen/ExpressionGen.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lib/CodeGen/ExpressionGen.cc') diff --git a/lib/CodeGen/ExpressionGen.cc b/lib/CodeGen/ExpressionGen.cc index 45583d3..38155e4 100644 --- a/lib/CodeGen/ExpressionGen.cc +++ b/lib/CodeGen/ExpressionGen.cc @@ -154,10 +154,11 @@ Value *CodeGen::emitExpr(ExprAST *Expr) { } if (auto *Call = dynamic_cast(Expr)) - return emitMemberCall(Call); + return emitMemberCall(Call, resultContext(Expr)); if (auto *Call = dynamic_cast(Expr)) - return emitCall(Call->getCallee(), Call->getArgs(), Call->getLine(), &Call->getTemplateArgs()); + return emitCall(Call->getCallee(), Call->getArgs(), Call->getLine(), + &Call->getTemplateArgs(), resultContext(Expr)); if (auto *D = dynamic_cast(Expr)) { LValueInfo LV; @@ -263,7 +264,8 @@ Value *CodeGen::emitBinaryOp(int Op, Value *L, const TypeInfo *LT, Value *CodeGen::emitCall(const std::string &Callee, const std::vector> &ArgExprs, int Line, - const std::vector *Explicit) { + const std::vector *Explicit, + const ResultContext *Context) { SaveAndRestore Location(DiagnosticLine, Line ? Line : DiagnosticLine); std::string Name = Callee; if (const BuiltinInfo *B = findBuiltin(Name)) { @@ -303,7 +305,7 @@ Value *CodeGen::emitCall(const std::string &Callee, std::vector Args; std::vector Variadic; - const FuncSig *Sig = resolveCall(Name, ArgExprs, Explicit); + const FuncSig *Sig = resolveCall(Name, ArgExprs, Explicit, Context); if (!Sig || !marshalCallArgs(*Sig, ArgExprs, Line, Args, &Variadic)) return nullptr; return FuncGen->emitCall(*Sig, Args, Variadic); } -- cgit v1.3.1-4-g156e