MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / const_to_val

Function const_to_val

compiler/src/modules/vm/optimizer.rs:177–184  ·  view source on GitHub ↗
(constants: &[Value], idx: u16)

Source from the content-addressed store, hash-verified

175}
176
177fn const_to_val(constants: &[Value], idx: u16) -> Option<Val> {
178 match constants.get(idx as usize)? {
179 Value::Int(i) if (Val::INT_MIN..=Val::INT_MAX).contains(i) => Some(Val::int(*i)),
180 Value::Float(f) => Some(Val::float(*f)),
181 Value::Bool(b) => Some(Val::bool(*b)),
182 _ => None,
183 }
184}
185
186/* Nearest live instruction before `from`; skips entries already marked dead by inner folds. */
187fn prev_live(dead: &[bool], from: usize) -> Option<usize> {

Callers 3

try_fold_binopFunction · 0.85
try_fold_notFunction · 0.85
try_fold_negFunction · 0.85

Calls 2

getMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected