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

Method ast_from_object

crates/vm/src/stdlib/_ast/pattern.rs:27–49  ·  view source on GitHub ↗
(
        vm: &VirtualMachine,
        source_file: &SourceFile,
        object: PyObjectRef,
    )

Source from the content-addressed store, hash-verified

25 }
26
27 fn ast_from_object(
28 vm: &VirtualMachine,
29 source_file: &SourceFile,
30 object: PyObjectRef,
31 ) -> PyResult<Self> {
32 Ok(Self {
33 node_index: Default::default(),
34 pattern: Node::ast_from_object(
35 vm,
36 source_file,
37 get_node_field(vm, &object, "pattern", "match_case")?,
38 )?,
39 guard: get_node_field_opt(vm, &object, "guard")?
40 .map(|obj| Node::ast_from_object(vm, source_file, obj))
41 .transpose()?,
42 body: Node::ast_from_object(
43 vm,
44 source_file,
45 get_node_field(vm, &object, "body", "match_case")?,
46 )?,
47 range: Default::default(),
48 })
49 }
50}
51
52// sum

Callers

nothing calls this directly

Calls 12

ast_from_objectFunction · 0.85
get_node_fieldFunction · 0.85
get_node_field_optFunction · 0.85
range_from_objectFunction · 0.85
SelfFunction · 0.85
isMethod · 0.80
ErrClass · 0.50
mapMethod · 0.45
classMethod · 0.45
is_noneMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected