MCPcopy Index your code
hub / github.com/RustPython/RustPython / template_str_to_expr

Function template_str_to_expr

crates/vm/src/stdlib/_ast/string.rs:700–717  ·  view source on GitHub ↗
(
    vm: &VirtualMachine,
    template: TemplateStr,
)

Source from the content-addressed store, hash-verified

698}
699
700pub(super) fn template_str_to_expr(
701 vm: &VirtualMachine,
702 template: TemplateStr,
703) -> PyResult<ast::Expr> {
704 let TemplateStr { range, values } = template;
705 let elements = template_parts_to_elements(vm, values)?;
706 let tstring = ast::TString {
707 range,
708 node_index: Default::default(),
709 elements,
710 flags: ast::TStringFlags::empty(),
711 };
712 Ok(ast::Expr::TString(ast::ExprTString {
713 node_index: Default::default(),
714 range,
715 value: ast::TStringValue::single(tstring),
716 }))
717}
718
719pub(super) fn interpolation_to_expr(
720 vm: &VirtualMachine,

Callers 1

ast_from_objectMethod · 0.85

Calls 1

Tested by

no test coverage detected