had a conversation w the code

This commit is contained in:
2025-04-25 00:37:42 -04:00
parent 329b1d86ac
commit d4edea0e62
12 changed files with 205 additions and 154 deletions
+5 -11
View File
@@ -49,7 +49,7 @@ impl PStruct {
let generics = self
.generics
.iter()
.flat_map(|a| a.as_ref()?.lower(p))
.flat_map(|a| a.lower(p))
.collect();
let fields = match &self.fields {
PStructFields::Named(nodes) => nodes
@@ -75,14 +75,7 @@ impl PStruct {
.into_iter()
.map(|(name, ty)| (name, StructField { ty }))
.collect();
p.write(
id,
UStruct {
origin: span,
generics,
fields,
},
);
p.write(id, UStruct { generics, fields });
p.pop();
Some(())
}
@@ -90,8 +83,9 @@ impl PStruct {
impl Node<PStruct> {
pub fn lower_name(&self, p: &mut UProgram) -> Option<StructID> {
let name = self.as_ref()?.name.as_ref()?.to_string();
let id = p.def_searchable(name.to_string(), None);
let s = self.as_ref()?;
let name = s.name.as_ref()?.to_string();
let id = p.def_searchable(name.to_string(), None, s.name.span);
Some(id)
}
pub fn lower(&self, id: StructID, p: &mut UProgram, output: &mut CompilerOutput) {