diff --git a/src/state.rs b/src/state.rs index a334f4a..3132012 100644 --- a/src/state.rs +++ b/src/state.rs @@ -249,7 +249,7 @@ impl <'a> State <'a> { Instruction::Closure (a, b) => { let b = usize::try_from (*b).unwrap (); - let idx = b + 1; + let idx = frame.block_idx + b + 1; let block = &chunk.blocks [idx]; let mut new_upvalues = Vec::with_capacity (block.upvalues.len ()); diff --git a/src/value.rs b/src/value.rs index b8257f2..c0ff740 100644 --- a/src/value.rs +++ b/src/value.rs @@ -11,6 +11,7 @@ use std::{ #[derive (Debug, Eq, PartialEq)] pub struct BogusClosure { + // I'm pretty sure this should be absolute? pub idx: usize, pub upvalues: Vec , }