diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-17 06:04:11 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-17 06:04:11 +0000 |
| commit | a99852084ff6f0491734d508a4dcd2e7d8411814 (patch) | |
| tree | fc849f47b5d657c2cfe1d4b0648725ff2a308299 /include/cps | |
| parent | 3425b95cb654f8e1adc98365a4b370aa1fff8b4d (diff) | |
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 <noreply@anthropic.com>
Diffstat (limited to 'include/cps')
| -rw-r--r-- | include/cps/CodeGen.h | 1 | ||||
| -rw-r--r-- | include/cps/FunctionAST.h | 1 |
2 files changed, 2 insertions, 0 deletions
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<ConstantScope> ConstantScopes = {{0, {}}}; unsigned NextScopeID = 1; void emitScopedBlock(const std::vector<std::unique_ptr<StmtAST>> &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<std::pair<int64_t, int64_t>> DeclaredBounds; + int Line = 0; }; class PrototypeAST { |
