initial structure impl

This commit is contained in:
2025-03-26 21:39:24 -04:00
parent 0614d48fcc
commit 021434d2f1
23 changed files with 390 additions and 84 deletions

View File

@@ -37,7 +37,10 @@ impl PType {
output: &mut CompilerOutput,
span: FileSpan,
) -> Type {
match namespace.get(&self.name).and_then(|ids| ids.ty) {
let Some(name) = self.name.as_ref() else {
return Type::Error;
};
match namespace.get(&name).and_then(|ids| ids.ty) {
Some(id) => {
if self.args.is_empty() {
Type::Concrete(id)
@@ -51,10 +54,10 @@ impl PType {
}
}
None => {
if let Ok(num) = self.name.parse::<u32>() {
if let Ok(num) = name.parse::<u32>() {
Type::Bits(num)
} else {
match self.name.as_str() {
match name.as_str() {
"slice" => {
let inner = self.args[0].lower(namespace, output);
Type::Slice(Box::new(inner))