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

Method ast_from_object

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

Source from the content-addressed store, hash-verified

119 }
120
121 fn ast_from_object(
122 vm: &VirtualMachine,
123 source_file: &SourceFile,
124 object: PyObjectRef,
125 ) -> PyResult<Self> {
126 let value_object = get_node_field(vm, &object, "value", "Constant")?;
127 let value = Node::ast_from_object(vm, source_file, value_object)?;
128
129 Ok(Self {
130 value,
131 // kind: get_node_field_opt(_vm, &_object, "kind")?
132 // .map(|obj| Node::ast_from_object(_vm, obj))
133 // .transpose()?,
134 range: range_from_object(vm, source_file, object, "Constant")?,
135 })
136 }
137}
138
139impl Node for ConstantLiteral {

Callers

nothing calls this directly

Calls 15

get_node_fieldFunction · 0.85
ast_from_objectFunction · 0.85
range_from_objectFunction · 0.85
BoolClass · 0.85
BytesClass · 0.85
TupleClass · 0.85
isMethod · 0.80
try_to_valueMethod · 0.80
try_into_valueMethod · 0.80
try_complexMethod · 0.80
IntClass · 0.50
FloatClass · 0.50

Tested by

no test coverage detected