(stmt: &Statement<'_>, ctx: &mut DiagnosticCtx<'_>)
| 90 | // ─── AST walking ──────────────────────────────────────────────────────────── |
| 91 | |
| 92 | fn collect_from_statement(stmt: &Statement<'_>, ctx: &mut DiagnosticCtx<'_>) { |
| 93 | match stmt { |
| 94 | Statement::Function(func) => { |
| 95 | let body_start = func.body.left_brace.start.offset; |
| 96 | let body_end = func.body.right_brace.end.offset; |
| 97 | let compact_vars = collect_compact_vars(func.body.statements.as_slice()); |
| 98 | let scope = collect_function_scope_with_resolver( |
| 99 | &func.parameter_list, |
| 100 | func.body.statements.as_slice(), |
| 101 | body_start, |
| 102 | body_end, |
| 103 | None, |
| 104 | ); |
| 105 | check_scope(&scope, ctx, None, &compact_vars); |
| 106 | } |
| 107 | Statement::Class(class) => { |
| 108 | collect_from_class_members(class.members.as_slice(), ctx); |
| 109 | } |
| 110 | Statement::Trait(tr) => { |
| 111 | collect_from_class_members(tr.members.as_slice(), ctx); |
| 112 | } |
| 113 | Statement::Enum(en) => { |
| 114 | collect_from_class_members(en.members.as_slice(), ctx); |
| 115 | } |
| 116 | Statement::Interface(_) => { |
| 117 | // Interfaces don't have method bodies. |
| 118 | } |
| 119 | Statement::Namespace(ns) => { |
| 120 | for inner in ns.statements().iter() { |
| 121 | collect_from_statement(inner, ctx); |
| 122 | } |
| 123 | } |
| 124 | _ => { |
| 125 | // Top-level code — don't diagnose (global scope has |
| 126 | // too many implicit variable definitions). |
| 127 | } |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | fn collect_from_class_members(members: &[ClassLikeMember<'_>], ctx: &mut DiagnosticCtx<'_>) { |
| 132 | for member in members.iter() { |
no test coverage detected