travel fn path for compilation

This commit is contained in:
2024-12-07 20:03:19 -05:00
parent e63f652eb5
commit 0e0dbd647d
15 changed files with 230 additions and 259 deletions

View File

@@ -37,7 +37,7 @@ impl PType {
output: &mut ParserOutput,
span: FileSpan,
) -> Type {
match namespace.get(&self.name).map(|ids| ids.ty).flatten() {
match namespace.get(&self.name).and_then(|ids| ids.ty) {
Some(id) => {
if self.args.is_empty() {
Type::Concrete(id)
@@ -51,8 +51,12 @@ impl PType {
}
}
None => {
output.err(ParserMsg::from_span(span, "Type not found".to_string()));
Type::Error
if let Ok(num) = self.name.parse::<u32>() {
Type::Bits(num)
} else {
output.err(ParserMsg::from_span(span, "Type not found".to_string()));
Type::Error
}
}
}
}