conlang: Add Tuple-Struct Patterns

- Patterns are no longer parsed with the highest precedence
- Function calls with just a path and a tuple of args can now be transformed into a Pattern
This commit is contained in:
2025-02-22 01:37:08 -06:00
parent 5d2c714bc1
commit 697d139cfd
9 changed files with 46 additions and 5 deletions

View File

@@ -127,6 +127,10 @@ impl<'a> Visit<'a> for CollectUpvars<'_> {
});
});
}
Pattern::TupleStruct(path, items) => {
self.visit_path(path);
items.iter().for_each(|bind| self.visit_pattern(bind));
}
}
}
}

View File

@@ -320,6 +320,9 @@ mod assignment {
None => set.push(name),
});
}
Pattern::TupleStruct(_path, items) => {
items.iter().for_each(|pat| patvars(set, pat));
}
}
}
let mut set = Vec::new();