diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-18 08:09:06 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-18 08:09:06 +0000 |
| commit | 30fced09675acfd2b9ab6db6be8359a70d3f0402 (patch) | |
| tree | 88dc4587cb71d9dc9bdd9a57c4e2de8a98d7f06e /lib/CodeGen/FunctionGen.cc | |
| parent | 345e3d419eafb0e234aecb4a33f37efe2afbbf53 (diff) | |
feat(operators): allow member assignment operator overloads
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'lib/CodeGen/FunctionGen.cc')
| -rw-r--r-- | lib/CodeGen/FunctionGen.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/CodeGen/FunctionGen.cc b/lib/CodeGen/FunctionGen.cc index 37df8ff..1f7bc2b 100644 --- a/lib/CodeGen/FunctionGen.cc +++ b/lib/CodeGen/FunctionGen.cc @@ -132,6 +132,12 @@ Function *FunctionGen::emitPrototype(PrototypeAST *Proto) { return nullptr; } } + if (Proto->getOperator() == tok_assign && + (Proto->getOwnerClass().empty() || !Proto->isOverload() || + !sameIdentifier(Proto->getReturnType(), "VOID"))) { + reportError("Assignment operator must be an OVERLOAD member PROCEDURE"); + return nullptr; + } if (int Op = Proto->getOperator()) { size_t Count = Proto->getParams().size() + !Proto->getOwnerClass().empty(); bool ValidCount = Op == '-' ? Count == 1 || Count == 2 |
