actually compiles and does stuff now

This commit is contained in:
2024-12-06 19:44:33 -05:00
parent 31c197e991
commit 620c4557e9
67 changed files with 1931 additions and 1287 deletions

39
src/ir/upper/def.rs Normal file
View File

@@ -0,0 +1,39 @@
use super::{FileSpan, Type};
use std::fmt::Debug;
#[derive(Clone)]
pub struct FnDef {
pub name: String,
pub args: Vec<VarDef>,
pub ret: Type,
pub origin: Origin,
}
#[derive(Clone)]
pub struct TypeDef {
pub name: String,
pub args: usize,
pub origin: Origin,
}
#[derive(Clone)]
pub struct VarDef {
pub name: String,
pub ty: Type,
pub origin: Origin,
}
#[derive(Debug, Clone, Copy)]
pub enum Origin {
Builtin,
File(FileSpan),
}
impl FnDef {
pub fn ty(&self) -> Type {
Type::Fn {
args: self.args.iter().map(|a| a.ty.clone()).collect(),
ret: Box::new(self.ret.clone()),
}
}
}