moving to desktop
This commit is contained in:
@@ -9,14 +9,14 @@ impl Node<Box<PType>> {
|
||||
pub fn lower(&self, p: &mut UModuleBuilder, output: &mut CompilerOutput) -> TypeID {
|
||||
self.as_ref()
|
||||
.map(|t| t.lower(p, output, self.origin))
|
||||
.unwrap_or(p.error())
|
||||
.unwrap_or(p.error)
|
||||
}
|
||||
}
|
||||
impl Node<PType> {
|
||||
pub fn lower(&self, p: &mut UModuleBuilder, output: &mut CompilerOutput) -> TypeID {
|
||||
self.as_ref()
|
||||
.map(|t| t.lower(p, output, self.origin))
|
||||
.unwrap_or(p.error())
|
||||
.unwrap_or(p.error)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ impl PType {
|
||||
while let PType::Member(node, ident) = ty {
|
||||
ty = if let Some(t) = node.as_ref() {
|
||||
let Some(name) = ident.as_ref() else {
|
||||
return p.error();
|
||||
return p.error;
|
||||
};
|
||||
origin = node.origin;
|
||||
path.push(MemberID {
|
||||
@@ -43,18 +43,19 @@ impl PType {
|
||||
});
|
||||
&**t
|
||||
} else {
|
||||
return p.error();
|
||||
return p.error;
|
||||
};
|
||||
}
|
||||
if !path.is_empty() {
|
||||
let PType::Ident(id) = ty else {
|
||||
return p.error();
|
||||
return p.error;
|
||||
};
|
||||
path.push(MemberID {
|
||||
name: id.0.clone(),
|
||||
origin,
|
||||
});
|
||||
return p.def_ty(Type::Unres(ModPath { m: p.module, path }));
|
||||
let ty = Type::Unres(ModPath { m: p.module, path });
|
||||
return p.def_ty(ty);
|
||||
}
|
||||
let ty = match ty {
|
||||
PType::Member(_, _) => unreachable!(),
|
||||
@@ -70,31 +71,6 @@ impl PType {
|
||||
PType::Generic(node, nodes) => todo!(),
|
||||
};
|
||||
p.def_ty(ty)
|
||||
// let Some(name) = self.name.as_ref() else {
|
||||
// return p.error();
|
||||
// };
|
||||
// let ids = p.get_idents(name);
|
||||
// // TODO: should generics always take precedence?
|
||||
// if let Some(id) = ids.and_then(|ids| ids.get::<Type>()) {
|
||||
// Type::Generic { id }
|
||||
// } else if let Some(id) = ids.and_then(|ids| ids.get::<UStruct>()) {
|
||||
// let args = self.args.iter().map(|n| n.lower(p, output)).collect();
|
||||
// Type::Struct(StructInst { id, args })
|
||||
// } else if let Ok(num) = name.parse::<u32>() {
|
||||
// Type::Bits(num)
|
||||
// } else {
|
||||
// match name.as_str() {
|
||||
// "slice" => {
|
||||
// let inner = self.args[0].lower(p, output);
|
||||
// Type::Slice(Box::new(inner))
|
||||
// }
|
||||
// "_" => Type::Infer,
|
||||
// _ => {
|
||||
// output.err(CompilerMsg::from_span(span, "Type not found".to_string()));
|
||||
// Type::Error
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user