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

Method ast_to_object

crates/vm/src/stdlib/_ast/string.rs:383–397  ·  view source on GitHub ↗
(self, vm: &VirtualMachine, source_file: &SourceFile)

Source from the content-addressed store, hash-verified

381// constructor
382impl Node for JoinedStr {
383 fn ast_to_object(self, vm: &VirtualMachine, source_file: &SourceFile) -> PyObjectRef {
384 let Self { values, range } = self;
385 let node = NodeAst
386 .into_ref_with_type(vm, pyast::NodeExprJoinedStr::static_type().to_owned())
387 .unwrap();
388 let dict = node.as_object().dict().unwrap();
389 dict.set_item(
390 "values",
391 BoxedSlice(values).ast_to_object(vm, source_file),
392 vm,
393 )
394 .unwrap();
395 node_add_location(&dict, range, vm, source_file);
396 node.into()
397 }
398 fn ast_from_object(
399 vm: &VirtualMachine,
400 source_file: &SourceFile,

Callers 2

fstring_to_objectFunction · 0.45
tstring_to_objectFunction · 0.45

Calls 9

BoxedSliceClass · 0.85
node_add_locationFunction · 0.85
into_ref_with_typeMethod · 0.80
unwrapMethod · 0.45
to_ownedMethod · 0.45
dictMethod · 0.45
as_objectMethod · 0.45
set_itemMethod · 0.45
new_strMethod · 0.45

Tested by

no test coverage detected