use hax_rust_engine_macros::*;
use super::*;
#[derive_group_for_ast]
pub enum ResugaredItemKind {
Constant {
name: GlobalId,
body: Expr,
generics: Generics,
},
}
#[derive_group_for_ast]
#[allow(clippy::large_enum_variant)]
pub enum ResugaredExprKind {
BinOp {
op: GlobalId,
lhs: Expr,
rhs: Expr,
generic_args: Vec<GenericValue>,
bounds_impls: Vec<ImplExpr>,
trait_: Option<(ImplExpr, Vec<GenericValue>)>,
},
Tuple(Vec<Expr>),
LetPure {
lhs: Pat,
rhs: Expr,
body: Expr,
},
}
#[derive_group_for_ast]
pub enum ResugaredPatKind {}
#[derive_group_for_ast]
pub enum ResugaredTyKind {
Tuple(Vec<Ty>),
}
#[derive_group_for_ast]
pub enum ResugaredImplItemKind {}
#[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
);