structs r a lot more sane in code, can now actually assign & stuff

This commit is contained in:
2025-04-08 20:00:16 -04:00
parent cb9a366f43
commit 26e7a4da4a
21 changed files with 405 additions and 197 deletions

View File

@@ -1,8 +1,8 @@
use super::{CompilerMsg, CompilerOutput, FileSpan, FnLowerable, Node, PFunction};
use crate::{
ir::{
FnDef, FnID, IRUFunction, IRUInstrInst, IRUInstruction, IRUProgram, Idents, Origin, Type,
VarDef, VarInst,
FnDef, FnID, IRUFunction, IRUInstrInst, IRUInstruction, IRUProgram, Idents, Type, VarDef,
VarInst, FieldRef,
},
parser,
};
@@ -32,6 +32,7 @@ impl PFunction {
a.lower(map, output).unwrap_or(VarDef {
name: "{error}".to_string(),
origin: a.span,
parent: None,
ty: Type::Error,
})
})
@@ -117,6 +118,9 @@ impl FnLowerCtx<'_> {
pub fn temp(&mut self, ty: Type) -> VarInst {
self.program.temp_var(self.span, ty)
}
pub fn temp_subvar(&mut self, ty: Type, parent: FieldRef) -> VarInst {
self.program.temp_subvar(self.span, ty, parent)
}
pub fn push(&mut self, i: IRUInstruction) {
self.instructions.push(IRUInstrInst { i, span: self.span });
}