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

Method get_const_value_from

crates/codegen/src/ir.rs:771–788  ·  view source on GitHub ↗
(
        metadata: &CodeUnitMetadata,
        info: &InstructionInfo,
    )

Source from the content-addressed store, hash-verified

769 }
770
771 fn get_const_value_from(
772 metadata: &CodeUnitMetadata,
773 info: &InstructionInfo,
774 ) -> Option<ConstantData> {
775 match info.instr.real() {
776 Some(Instruction::LoadConst { .. }) => {
777 let idx = u32::from(info.arg) as usize;
778 metadata.consts.get_index(idx).cloned()
779 }
780 Some(Instruction::LoadSmallInt { .. }) => {
781 let v = u32::from(info.arg) as i32;
782 Some(ConstantData::Integer {
783 value: BigInt::from(v),
784 })
785 }
786 _ => None,
787 }
788 }
789
790 fn eval_binop(
791 left: &ConstantData,

Callers

nothing calls this directly

Calls 3

get_indexMethod · 0.80
SomeClass · 0.50
realMethod · 0.45

Tested by

no test coverage detected