Populates `expression` with necessary `Let` bindings. This population may result in substantially more `Let` bindings that one might expect. It is very appropriate to run the `NormalizeLets` transformation afterwards to remove `Let` bindings that it deems unhelpful.
(self, expression: &mut MirRelationExpr)
| 318 | /// might expect. It is very appropriate to run the `NormalizeLets` transformation |
| 319 | /// afterwards to remove `Let` bindings that it deems unhelpful. |
| 320 | fn populate_expression(self, expression: &mut MirRelationExpr) { |
| 321 | // Convert the bindings in to a sequence, by the local identifier. |
| 322 | let mut bindings = self.bindings.into_iter().collect::<Vec<_>>(); |
| 323 | bindings.sort_by_key(|(_, i)| *i); |
| 324 | |
| 325 | for (value, index) in bindings.into_iter().rev() { |
| 326 | let new_expression = MirRelationExpr::Let { |
| 327 | id: LocalId::new(index), |
| 328 | value: Box::new(value), |
| 329 | body: Box::new(expression.take_dangerous()), |
| 330 | }; |
| 331 | *expression = new_expression; |
| 332 | } |
| 333 | } |
| 334 | } |
no test coverage detected