support _type_.repr expression

This commit is contained in:
Alain Zscheile 2023-09-27 17:21:15 +02:00
parent 257d129ca6
commit 23b0305f30

View file

@ -473,13 +473,21 @@ impl Expr {
for (ispan, i) in &*then {
let span = ispan.into();
match pt {
pt @ (Expr::TyTy
| Expr::Tbool
| Expr::Tu32
| Expr::Tusize
| Expr::Record(_)) => {
pt @ (Expr::Tbool | Expr::Tu32 | Expr::Tusize | Expr::Record(_)) => {
return Err(Error::InvalidSelect { span, ty: pt });
}
Expr::TyTy => {
pt = match &**i {
"repr" => Expr::Trepr,
_ => {
return Err(Error::SelectNotFoundTy {
span,
name: i.clone(),
ty: Expr::TyTy,
})
}
};
}
Expr::Trepr => {
pt = match &**i {
"len" | "align" => Expr::Tusize,