diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-24 18:01:36 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-24 18:01:36 +0000 |
| commit | 0900667401415a0914b8a1510543c7c7eaf32e53 (patch) | |
| tree | e61c43059f880878bc59259e82c5ab6665b20dbd /lib/CodeGen/ExpressionGen.cc | |
| parent | 034ab48c5f30b0e6f402766b4c1bcf36661e16cd (diff) | |
feat(overload): select overloads by return type as well as parameters
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'lib/CodeGen/ExpressionGen.cc')
| -rw-r--r-- | lib/CodeGen/ExpressionGen.cc | 10 |
1 files changed, 6 insertions, 4 deletions
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<MemberCallExprAST*>(Expr)) - return emitMemberCall(Call); + return emitMemberCall(Call, resultContext(Expr)); if (auto *Call = dynamic_cast<CallExprAST*>(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<DesignatorExprAST*>(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<std::unique_ptr<ExprAST>> &ArgExprs, int Line, - const std::vector<std::string> *Explicit) { + const std::vector<std::string> *Explicit, + const ResultContext *Context) { SaveAndRestore<int> 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<Value*> Args; std::vector<const TypeInfo *> 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); } |
