(
vm: &VirtualMachine,
interpolation: TStringInterpolation,
)
| 717 | } |
| 718 | |
| 719 | pub(super) fn interpolation_to_expr( |
| 720 | vm: &VirtualMachine, |
| 721 | interpolation: TStringInterpolation, |
| 722 | ) -> PyResult<ast::Expr> { |
| 723 | let part = TemplateStrPart::Interpolation(interpolation); |
| 724 | let elements = template_parts_to_elements(vm, vec![part].into_boxed_slice())?; |
| 725 | let range = TextRange::default(); |
| 726 | let tstring = ast::TString { |
| 727 | range, |
| 728 | node_index: Default::default(), |
| 729 | elements, |
| 730 | flags: ast::TStringFlags::empty(), |
| 731 | }; |
| 732 | Ok(ast::Expr::TString(ast::ExprTString { |
| 733 | node_index: Default::default(), |
| 734 | range, |
| 735 | value: ast::TStringValue::single(tstring), |
| 736 | })) |
| 737 | } |
| 738 | |
| 739 | fn template_parts_to_elements( |
| 740 | vm: &VirtualMachine, |
no test coverage detected