diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-17 06:54:32 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-17 06:54:32 +0000 |
| commit | 74b6d06711afd3efbbc47436f1491900994313f3 (patch) | |
| tree | b9050214b147cd2b1b54fd27e75d669bf6146e48 /lib/CodeGen/Designator.cc | |
| parent | 39661855c0816ac248be437704c76f58359cb5f0 (diff) | |
feat(classes): allocate objects with NEW and rebind named class variables
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'lib/CodeGen/Designator.cc')
| -rw-r--r-- | lib/CodeGen/Designator.cc | 7 |
1 files changed, 4 insertions, 3 deletions
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<std::unique_ptr<StmtAST>> &Statem else if (auto *P = dynamic_cast<PointerTypeDeclAST*>(S.get())) Ok = Types->declareUserType(P->getName(), TypeKind::Pointer, Err); else if (auto *R = dynamic_cast<RecordTypeDeclAST*>(S.get())) - Ok = Types->declareUserType(R->getName(), TypeKind::Record, Err); + Ok = Types->declareUserType(R->getName(), TypeKind::Record, Err, + dynamic_cast<ClassTypeDeclAST*>(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; |
