From a99852084ff6f0491734d508a4dcd2e7d8411814 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Sat, 17 Oct 2026 06:04:11 +0000 Subject: feat(classes): warn when method declarations shadow fields Retain parameter source lines for warnings and preserve field access prefix validation when distinguishing fields from methods. Co-Authored-By: Claude Fable 5.1 --- include/cps/CodeGen.h | 1 + include/cps/FunctionAST.h | 1 + 2 files changed, 2 insertions(+) (limited to 'include/cps') diff --git a/include/cps/CodeGen.h b/include/cps/CodeGen.h index 1c80434..593cde0 100644 --- a/include/cps/CodeGen.h +++ b/include/cps/CodeGen.h @@ -43,6 +43,7 @@ class CodeGen { std::vector ConstantScopes = {{0, {}}}; unsigned NextScopeID = 1; void emitScopedBlock(const std::vector> &Body); + void warnMemberShadow(const std::string &Name, int Line) const; bool prepareSymbolDeclaration(const std::string &Name, bool IsConstant = false); bool requireWritable(const SymbolInfo &Info, const std::string &Name); void emitConstantStmt(ConstantStmtAST *Stmt); diff --git a/include/cps/FunctionAST.h b/include/cps/FunctionAST.h index 16057e5..9b2d49b 100644 --- a/include/cps/FunctionAST.h +++ b/include/cps/FunctionAST.h @@ -21,6 +21,7 @@ struct ParamDecl { bool IsArray = false; int Rank = 0; // 0 = scalar std::vector> DeclaredBounds; + int Line = 0; }; class PrototypeAST { -- cgit v1.3.1-4-g156e