a ton of stuff idk more ir work

This commit is contained in:
2024-10-22 02:30:50 -04:00
parent 14a4fb1ff9
commit 87f755b763
46 changed files with 1967 additions and 540 deletions

View File

@@ -0,0 +1,21 @@
use crate::ir::NamespaceGuard;
use super::{Module, ParserOutput};
impl Module {
pub fn lower(&self, map: &mut NamespaceGuard, output: &mut ParserOutput) {
let mut fns = Vec::new();
for f in &self.functions {
if let Some(id) = f.lower_header(map, output) {
fns.push(Some(id));
} else {
fns.push(None)
}
}
for (f, id) in self.functions.iter().zip(fns) {
if let (Some(res), Some(id)) = (f.lower_body(map, output), id) {
map.write_fn(id, res);
}
}
}
}