(if_stmt: &If<'_>, content: &str, ranges: &mut Vec<FoldingRange>)
| 352 | // ─── If statement ─────────────────────────────────────────────────────────── |
| 353 | |
| 354 | fn collect_from_if(if_stmt: &If<'_>, content: &str, ranges: &mut Vec<FoldingRange>) { |
| 355 | collect_from_expression(if_stmt.condition, content, ranges); |
| 356 | match &if_stmt.body { |
| 357 | IfBody::Statement(body) => { |
| 358 | collect_from_block_statement(body.statement, content, ranges); |
| 359 | for else_if in body.else_if_clauses.iter() { |
| 360 | collect_from_expression(else_if.condition, content, ranges); |
| 361 | collect_from_block_statement(else_if.statement, content, ranges); |
| 362 | } |
| 363 | if let Some(ref else_clause) = body.else_clause { |
| 364 | collect_from_block_statement(else_clause.statement, content, ranges); |
| 365 | } |
| 366 | } |
| 367 | IfBody::ColonDelimited(body) => { |
| 368 | for inner in body.statements.iter() { |
| 369 | collect_from_statement(inner, content, ranges); |
| 370 | } |
| 371 | for else_if in body.else_if_clauses.iter() { |
| 372 | collect_from_expression(else_if.condition, content, ranges); |
| 373 | for inner in else_if.statements.iter() { |
| 374 | collect_from_statement(inner, content, ranges); |
| 375 | } |
| 376 | } |
| 377 | if let Some(ref else_clause) = body.else_clause { |
| 378 | for inner in else_clause.statements.iter() { |
| 379 | collect_from_statement(inner, content, ranges); |
| 380 | } |
| 381 | } |
| 382 | } |
| 383 | } |
| 384 | } |
| 385 | |
| 386 | // ─── Class member walker ──────────────────────────────────────────────────── |
| 387 |
no test coverage detected