moving to desktop

This commit is contained in:
2025-05-02 22:03:32 -04:00
parent 57c46b653e
commit 5f36be9de9
19 changed files with 197 additions and 236 deletions
+4 -34
View File
@@ -1,4 +1,4 @@
use super::{Type, UInstrInst, UInstruction, UProgram};
use super::{Type, UInstrInst, UInstruction};
use crate::{
common::FileSpan,
ir::{Len, ID},
@@ -12,7 +12,7 @@ pub struct UFunc {
pub name: String,
pub origin: Origin,
pub args: Vec<VarID>,
pub argtys: Vec<TypeID>,
pub gargs: Vec<TypeID>,
pub ret: TypeID,
pub instructions: Vec<UInstrInst>,
}
@@ -41,13 +41,8 @@ pub struct UVar {
pub name: String,
pub origin: Origin,
pub ty: TypeID,
pub res: UVarTy,
}
#[derive(Clone)]
pub struct VarParent {
id: VarID,
path: Vec<String>,
pub parent: Option<VarID>,
pub children: Vec<VarID>,
}
#[derive(Clone, PartialEq, Eq, Hash)]
@@ -62,25 +57,6 @@ pub struct ModPath {
pub path: Vec<MemberID>,
}
#[derive(Clone)]
pub enum UVarTy {
Ptr(VarID),
/// fully resolved & typed
Res {
parent: Option<VarParent>,
},
/// module doesn't exist yet
Unres {
path: ModPath,
fields: Vec<MemberID>,
},
/// parent var exists but not typed enough for this field path
Partial {
v: VarID,
fields: Vec<MemberID>,
},
}
#[derive(Debug, Clone, Copy, Hash, Eq, PartialEq)]
pub struct VarOffset {
pub id: VarID,
@@ -117,12 +93,6 @@ pub enum Member {
pub type Origin = FileSpan;
impl UFunc {
pub fn ty(&self, program: &UProgram) -> Type {
Type::Fn {
args: self.argtys.clone(),
ret: Box::new(self.ret.clone()),
}
}
pub fn flat_iter(&self) -> impl Iterator<Item = &UInstrInst> {
InstrIter::new(self.instructions.iter())
}