From 4cb0d9b196008bc55dbfcdac1f9211dbbc879895 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Fri, 30 Oct 2026 14:23:32 +0000 Subject: feat(types): support implicit single-argument constructors Co-Authored-By: Claude Opus 5.5 --- include/cps/CodeGen.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'include/cps/CodeGen.h') diff --git a/include/cps/CodeGen.h b/include/cps/CodeGen.h index c3a7b19..c0ae997 100644 --- a/include/cps/CodeGen.h +++ b/include/cps/CodeGen.h @@ -148,6 +148,11 @@ class CodeGen { llvm::Value *emitCStringExpr(ExprAST *Expr); llvm::Value *emitFileNameOperand(ExprAST *E, const char *Keyword); bool containsString(const TypeInfo *Type) const; + const FuncSig *findImplicitConstructor(const TypeInfo *Source, const TypeInfo *Target); + bool canImplicitlyConvert(const TypeInfo *Source, const TypeInfo *Target); + llvm::Value *emitImplicitConstruct(const FuncSig &Constructor, const TypeInfo *Target, + llvm::Value *Argument, + const std::vector &Transfers = {}); std::unique_ptr Types; std::unique_ptr Arrays; @@ -230,7 +235,7 @@ class CodeGen { 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); + const TypeInfo *LeftType, llvm::Value *Right, const TypeInfo *RightType); llvm::Value *emitVariadicArgument(ExprAST *Expr, const std::string &Callee, size_t Position, const TypeInfo *&Promoted); // Variadic, if given, receives the promoted type of each variadic argument. -- cgit v1.3.1-4-g156e