use hax_rust_engine_macros::*;
use super::*;
#[derive_group_for_ast]
pub enum ResugaredItemKind {
Constant {
name: GlobalId,
body: Expr,
generics: Generics,
},
RecursiveFn {
name: GlobalId,
generics: Generics,
body: Expr,
params: Vec<Param>,
safety: SafetyKind,
},
}
#[derive_group_for_ast]
#[allow(clippy::large_enum_variant)]
pub enum ResugaredExprKind {
Tuple(Vec<Expr>),
LetPure {
lhs: Pat,
rhs: Expr,
body: Expr,
},
}
#[derive_group_for_ast]
pub enum ResugaredPatKind {
ConstructWithEllipsis {
constructor: GlobalId,
is_struct: bool,
fields: Vec<(GlobalId, Pat)>,
},
}
#[derive_group_for_ast]
pub enum ResugaredTyKind {
Tuple(Vec<Ty>),
}
#[derive_group_for_ast]
pub enum ResugaredImplItemKind {
Constant {
body: Expr,
},
}
#[derive_group_for_ast]
pub enum ResugaredTraitItemKind {}
pub trait ResugaredFragment {
type ParentFragment;
}
macro_rules! derive_from {
($($ty:ty => $parent:ty),*) => {
$(impl ResugaredFragment for $ty {
type ParentFragment = $parent;
}
impl From<$ty> for <$ty as ResugaredFragment>::ParentFragment {
fn from(value: $ty) -> Self {
Self::Resugared(value)
}
})*
};
}
derive_from!(
ResugaredItemKind => ItemKind,
ResugaredExprKind => ExprKind,
ResugaredPatKind => PatKind,
ResugaredTyKind => TyKind,
ResugaredImplItemKind => ImplItemKind,
ResugaredTraitItemKind => TraitItemKind
);