From 74b6d06711afd3efbbc47436f1491900994313f3 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Sat, 17 Oct 2026 06:54:32 +0000 Subject: feat(classes): allocate objects with NEW and rebind named class variables Co-Authored-By: Claude Opus 5.5 --- lib/CodeGen/Designator.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/CodeGen/Designator.cc') diff --git a/lib/CodeGen/Designator.cc b/lib/CodeGen/Designator.cc index 1ebd158..5f54a87 100644 --- a/lib/CodeGen/Designator.cc +++ b/lib/CodeGen/Designator.cc @@ -24,7 +24,8 @@ void CodeGen::runTypePrePass(const std::vector> &Statem else if (auto *P = dynamic_cast(S.get())) Ok = Types->declareUserType(P->getName(), TypeKind::Pointer, Err); else if (auto *R = dynamic_cast(S.get())) - Ok = Types->declareUserType(R->getName(), TypeKind::Record, Err); + Ok = Types->declareUserType(R->getName(), TypeKind::Record, Err, + dynamic_cast(R) != nullptr); if (!Ok) reportError("%s", Err.c_str()); } @@ -120,7 +121,7 @@ bool CodeGen::emitLValue(ExprAST *E, LValueInfo &Out) { reportError("Whole array %s is not an assignable location; index it", Var->getName().c_str()); return false; } - Out.Addr = Info->Storage; + Out.Addr = symbolAddress(*Info); Out.TypeName = Info->TypeName; return true; } @@ -148,7 +149,7 @@ bool CodeGen::emitLValue(ExprAST *E, LValueInfo &Out) { if (!requireWritable(*Info, D->getBaseName())) return false; const auto &Accesses = D->getAccesses(); - Value *Addr = Info->Storage; + Value *Addr = symbolAddress(*Info); std::string TypeName = Info->TypeName; size_t Start = 0; -- cgit v1.3.1-4-g156e