mindustry logic execution, map- and schematic- parsing and rendering
Diffstat (limited to 'lemu/src/debug/info.rs')
| -rw-r--r-- | lemu/src/debug/info.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lemu/src/debug/info.rs b/lemu/src/debug/info.rs index 6f370ba..5b38f81 100644 --- a/lemu/src/debug/info.rs +++ b/lemu/src/debug/info.rs @@ -6,7 +6,7 @@ use crate::{ }; pub struct DebugInfo<'s> { - variables: Box<[Option<VarInfo<'s>>; 255]>, + variables: Box<[Option<VarInfo<'s>>; 65536]>, /// maps "start" to 0 pub labels: Vec<(&'s str, Instruction)>, } @@ -14,7 +14,7 @@ pub struct DebugInfo<'s> { impl<'s> Default for DebugInfo<'s> { fn default() -> Self { Self { - variables: Box::new([const { None }; 255]), + variables: vec![None; 65536].try_into().unwrap(), labels: vec![], } } @@ -38,14 +38,14 @@ impl<'s> std::ops::Index<LAddress> for DebugInfo<'s> { } impl<'s> DebugInfo<'s> { - pub fn set_var(&mut self, at: u8, name: &'s str, span: Range<usize>) { + pub fn set_var(&mut self, at: u16, name: &'s str, span: Range<usize>) { self.variables[at as usize] = Some(VarInfo { data: VarData::Variable(name), span, }); } - pub fn set_const(&mut self, at: u8, var: impl Into<LVar<'s>>, span: Range<usize>) { + pub fn set_const(&mut self, at: u16, var: impl Into<LVar<'s>>, span: Range<usize>) { self.variables[at as usize] = Some(VarInfo { data: VarData::Constant(var.into()), span, @@ -53,14 +53,14 @@ impl<'s> DebugInfo<'s> { } } -#[derive(Clone)] +#[derive(Clone, Debug)] struct VarInfo<'s> { pub data: VarData<'s>, #[allow(dead_code)] pub span: Range<usize>, } -#[derive(Clone)] +#[derive(Clone, Debug)] pub enum VarData<'s> { Variable(&'s str), // not necessary, but convenient. |