cl-ast: Cleanup
- Function bind is now one Pattern - TyRef now allows &Ty (i.e. &[i32], &(char, bool) - Range patterns (they cannot bind, only check whether a value is in range - ArrayRep repeat has been reverted to usize, for now, until early consteval is implemented.
This commit is contained in:
@@ -469,7 +469,7 @@ impl Parse<'_> for Function {
|
||||
}
|
||||
}
|
||||
|
||||
type FnSig = (Vec<Pattern>, Vec<TyKind>);
|
||||
type FnSig = (Pattern, Vec<TyKind>);
|
||||
|
||||
impl Parse<'_> for FnSig {
|
||||
/// Parses the [parameters](Param) associated with a Function
|
||||
@@ -484,7 +484,7 @@ impl Parse<'_> for FnSig {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Ok((params, types))
|
||||
Ok((Pattern::Tuple(params), types))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -783,7 +783,7 @@ impl Parse<'_> for TyRef {
|
||||
}
|
||||
p.consume_peeked();
|
||||
}
|
||||
Ok(TyRef { count, mutable: Mutability::parse(p)?, to: Path::parse(p)? })
|
||||
Ok(TyRef { count, mutable: Mutability::parse(p)?, to: Box::new(Ty::parse(p)?) })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -203,7 +203,13 @@ fn exprkind_array_rep(p: &mut Parser) -> PResult<ExprKind> {
|
||||
value: first.into(),
|
||||
repeat: {
|
||||
p.consume_peeked();
|
||||
Box::new(expr(p, 0)?)
|
||||
let value = p.match_type(TokenKind::Literal, Parsing::ArrayRep)?;
|
||||
match value.data() {
|
||||
TokenData::Integer(size) => *size as usize,
|
||||
_ => {
|
||||
Err(p.error(ErrorKind::Unexpected(TokenKind::Literal), Parsing::ArrayRep))?
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
.into(),
|
||||
|
||||
Reference in New Issue
Block a user