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 /lib/CodeGen/StatementGen.cc | |
| 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 'lib/CodeGen/StatementGen.cc')
| -rw-r--r-- | lib/CodeGen/StatementGen.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/CodeGen/StatementGen.cc b/lib/CodeGen/StatementGen.cc index c55aebe..2443877 100644 --- a/lib/CodeGen/StatementGen.cc +++ b/lib/CodeGen/StatementGen.cc @@ -23,6 +23,8 @@ void CodeGen::emitStmt(StmtAST *Stmt) { if (auto *FuncDef = dynamic_cast<FunctionDefAST*>(Stmt)) { SaveAndRestore<std::string> ClassContext(CurrentClass, FuncDef->getProto()->getOwnerClass()); + for (const auto &Param : FuncDef->getProto()->getParams()) + warnMemberShadow(Param.Name, Param.Line ? Param.Line : DiagnosticLine); BasicBlock *SavedBlock = Builder->GetInsertBlock(); // Function bodies get a fresh array scope (metadata SSA values belong // to the emitting function), mirroring FunctionGen's Symbols handling. |
