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

Function string_literal_to_object

crates/vm/src/stdlib/_ast/constant.rs:376–392  ·  view source on GitHub ↗
(
    vm: &VirtualMachine,
    source_file: &SourceFile,
    constant: ast::ExprStringLiteral,
)

Source from the content-addressed store, hash-verified

374}
375
376pub(super) fn string_literal_to_object(
377 vm: &VirtualMachine,
378 source_file: &SourceFile,
379 constant: ast::ExprStringLiteral,
380) -> PyObjectRef {
381 let ast::ExprStringLiteral {
382 node_index: _,
383 range,
384 value,
385 } = constant;
386 let prefix = value
387 .iter()
388 .next()
389 .map_or(StringLiteralPrefix::Empty, |part| part.flags.prefix());
390 let c = Constant::new_str(value.to_str(), prefix, range);
391 c.ast_to_object(vm, source_file)
392}
393
394pub(super) fn bytes_literal_to_object(
395 vm: &VirtualMachine,

Callers 1

ast_to_objectMethod · 0.85

Calls 5

prefixMethod · 0.80
to_strMethod · 0.80
nextMethod · 0.45
iterMethod · 0.45
ast_to_objectMethod · 0.45

Tested by

no test coverage detected