Flatten a SelectionRange linked list into a Vec of Ranges (innermost first).
(sel: &SelectionRange)
| 907 | |
| 908 | /// Flatten a SelectionRange linked list into a Vec of Ranges (innermost first). |
| 909 | fn flatten(sel: &SelectionRange) -> Vec<Range> { |
| 910 | let mut result = vec![sel.range]; |
| 911 | let mut current = &sel.parent; |
| 912 | while let Some(parent) = current { |
| 913 | result.push(parent.range); |
| 914 | current = &parent.parent; |
| 915 | } |
| 916 | result |
| 917 | } |
| 918 | |
| 919 | #[test] |
| 920 | fn single_variable_in_function() { |