Iterates through mutable references to child expressions.
(&mut self)
| 2285 | |
| 2286 | /// Iterates through mutable references to child expressions. |
| 2287 | pub fn children_mut(&mut self) -> impl DoubleEndedIterator<Item = &mut Self> { |
| 2288 | let mut first = None; |
| 2289 | let mut second = None; |
| 2290 | let mut rest = None; |
| 2291 | let mut last = None; |
| 2292 | |
| 2293 | use MirRelationExpr::*; |
| 2294 | match self { |
| 2295 | Constant { .. } | Get { .. } => (), |
| 2296 | Let { value, body, .. } => { |
| 2297 | first = Some(&mut **value); |
| 2298 | second = Some(&mut **body); |
| 2299 | } |
| 2300 | LetRec { values, body, .. } => { |
| 2301 | rest = Some(values); |
| 2302 | last = Some(&mut **body); |
| 2303 | } |
| 2304 | Project { input, .. } |
| 2305 | | Map { input, .. } |
| 2306 | | FlatMap { input, .. } |
| 2307 | | Filter { input, .. } |
| 2308 | | Reduce { input, .. } |
| 2309 | | TopK { input, .. } |
| 2310 | | Negate { input } |
| 2311 | | Threshold { input } |
| 2312 | | ArrangeBy { input, .. } => { |
| 2313 | first = Some(&mut **input); |
| 2314 | } |
| 2315 | Join { inputs, .. } => { |
| 2316 | rest = Some(inputs); |
| 2317 | } |
| 2318 | Union { base, inputs } => { |
| 2319 | first = Some(&mut **base); |
| 2320 | rest = Some(inputs); |
| 2321 | } |
| 2322 | } |
| 2323 | |
| 2324 | first |
| 2325 | .into_iter() |
| 2326 | .chain(second) |
| 2327 | .chain(rest.into_iter().flatten()) |
| 2328 | .chain(last) |
| 2329 | } |
| 2330 | |
| 2331 | /// Iterative pre-order visitor. |
| 2332 | pub fn visit_pre<'a, F: FnMut(&'a Self)>(&'a self, mut f: F) { |
no test coverage detected