(&mut self, expr: &'_ mut Expr<Aug>)
| 2998 | |
| 2999 | impl VisitMut<'_, Aug> for MzNowPurifierVisitor { |
| 3000 | fn visit_expr_mut(&mut self, expr: &'_ mut Expr<Aug>) { |
| 3001 | match expr { |
| 3002 | Expr::Function(Function { |
| 3003 | name: |
| 3004 | ResolvedItemName::Item { |
| 3005 | full_name: FullItemName { item, .. }, |
| 3006 | .. |
| 3007 | }, |
| 3008 | .. |
| 3009 | }) if item == &MZ_NOW_NAME.to_string() => { |
| 3010 | let mz_now = self.mz_now.expect( |
| 3011 | "we should have chosen a timestamp if the expression contains mz_now()", |
| 3012 | ); |
| 3013 | // We substitute `mz_now()` with number + a cast to `mz_timestamp`. The cast is to |
| 3014 | // not alter the type of the expression. |
| 3015 | *expr = Expr::Cast { |
| 3016 | expr: Box::new(Expr::Value(Value::Number(mz_now.to_string()))), |
| 3017 | data_type: self.mz_timestamp_type.clone(), |
| 3018 | }; |
| 3019 | self.introduced_mz_timestamp = true; |
| 3020 | } |
| 3021 | _ => visit_expr_mut(self, expr), |
| 3022 | } |
| 3023 | } |
| 3024 | } |
no test coverage detected