From bd7384123c63032711daf5fb0fc6ff428df859d0 Mon Sep 17 00:00:00 2001 From: mlokr Date: Sun, 7 Jul 2024 14:29:37 +0200 Subject: [PATCH] brahmaputra 2 --- hblang/src/codegen.rs | 6 ------ hblang/src/parser.rs | 7 ++++--- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/hblang/src/codegen.rs b/hblang/src/codegen.rs index 864ad501..42d3e1c1 100644 --- a/hblang/src/codegen.rs +++ b/hblang/src/codegen.rs @@ -1274,12 +1274,6 @@ struct StringReloc { shifted: bool, } -impl StringReloc { - fn range(&self) -> std::ops::Range { - self.range.start as _..self.range.end as _ - } -} - #[derive(Default)] pub struct Codegen { pub files: Vec, diff --git a/hblang/src/parser.rs b/hblang/src/parser.rs index 16c2dab7..eb3bdb3d 100644 --- a/hblang/src/parser.rs +++ b/hblang/src/parser.rs @@ -879,11 +879,12 @@ impl<'a> std::fmt::Display for Expr<'a> { writeln!(f)?; INDENT.with(|i| i.set(i.get() + 1)); let res = (|| { - for stmt in list { + for stmt in stmts { for _ in 0..INDENT.with(|i| i.get()) { write!(f, "\t")?; } - fmt(stmt, f)?; + stmt.fmt(f)?; + writeln!(f)?; } Ok(()) })(); @@ -891,7 +892,7 @@ impl<'a> std::fmt::Display for Expr<'a> { for _ in 0..INDENT.with(|i| i.get()) { write!(f, "\t")?; } - write!(f, "{end}")?; + write!(f, "}}")?; res } Self::Number { value, .. } => write!(f, "{value}"),