From 3425b95cb654f8e1adc98365a4b370aa1fff8b4d Mon Sep 17 00:00:00 2001 From: _ov4 Date: Sat, 17 Oct 2026 06:02:21 +0000 Subject: feat(classes): support ordinary member methods and this references Co-Authored-By: Claude Fable 5.1 --- lib/CodeGen/ConstantGen.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/CodeGen/ConstantGen.cc') diff --git a/lib/CodeGen/ConstantGen.cc b/lib/CodeGen/ConstantGen.cc index e14e22f..12bf4b1 100644 --- a/lib/CodeGen/ConstantGen.cc +++ b/lib/CodeGen/ConstantGen.cc @@ -16,6 +16,10 @@ void CodeGen::emitScopedBlock(const std::vector> &Body) } bool CodeGen::prepareSymbolDeclaration(const std::string &Name, bool IsConstant) { + if (!CurrentClass.empty() && sameIdentifier(Name, "this")) { + reportError("Cannot redeclare this inside a method"); + return false; + } auto &Scope = ConstantScopes.back(); auto It = Symbols.find(Name); if (It != Symbols.end()) { -- cgit v1.3.1-4-g156e