Parse destructured tag annotations as annotations rather than aliases

Closes #178
This commit is contained in:
ayazhafiz 2021-12-26 15:39:36 -06:00
parent fe62e59e31
commit b3ddfa7515
8 changed files with 192 additions and 34 deletions

View file

@ -265,6 +265,17 @@ pub enum Def<'a> {
NotYetImplemented(&'static str),
}
impl<'a> Def<'a> {
pub fn unroll_spaces_before(&self) -> (&'a [CommentOrNewline<'a>], &Def) {
let (spaces, def): (&'a [_], &Def) = match self {
Def::SpaceBefore(def, spaces) => (spaces, def),
def => (&[], def),
};
debug_assert!(!matches!(def, Def::SpaceBefore(_, _)));
(spaces, def)
}
}
#[derive(Debug, Copy, Clone, PartialEq)]
pub enum TypeAnnotation<'a> {
/// A function. The types of its arguments, then the type of its return value.