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

Function number_literal_to_object

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

Source from the content-addressed store, hash-verified

356}
357
358pub(super) fn number_literal_to_object(
359 vm: &VirtualMachine,
360 source_file: &SourceFile,
361 constant: ast::ExprNumberLiteral,
362) -> PyObjectRef {
363 let ast::ExprNumberLiteral {
364 node_index: _,
365 range,
366 value,
367 } = constant;
368 let c = match value {
369 ast::Number::Int(n) => Constant::new_int(n, range),
370 ast::Number::Float(n) => Constant::new_float(n, range),
371 ast::Number::Complex { real, imag } => Constant::new_complex(real, imag, range),
372 };
373 c.ast_to_object(vm, source_file)
374}
375
376pub(super) fn string_literal_to_object(
377 vm: &VirtualMachine,

Callers 1

ast_to_objectMethod · 0.85

Calls 1

ast_to_objectMethod · 0.45

Tested by

no test coverage detected