improve debugging

This commit is contained in:
nora 2022-04-15 23:33:12 +02:00
parent c3c24c73fe
commit 7973d9f77b
8 changed files with 189 additions and 32 deletions

View file

@ -1,13 +1,14 @@
use crate::parse::{Instr, Span};
use crate::BumpVec;
use bumpalo::Bump;
use std::fmt::{Debug, Formatter};
#[derive(Debug, Clone)]
pub struct Ir<'ir> {
pub stmts: BumpVec<'ir, Stmt<'ir>>,
}
#[derive(Debug, Clone)]
#[derive(Clone)]
pub struct Stmt<'ir> {
pub kind: StmtKind<'ir>,
pub span: Span,
@ -23,6 +24,12 @@ impl<'ir> Stmt<'ir> {
}
}
impl Debug for Stmt<'_> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
f.debug_tuple("Stmt").field(&self.kind).finish()
}
}
#[derive(Debug, Clone)]
pub enum StmtKind<'ir> {
Add(u8),