Improve reify! syntax.

This commit is contained in:
Stephen Chung
2022-12-09 16:41:01 +08:00
parent 3d5908480a
commit 30ff208104
9 changed files with 64 additions and 68 deletions

View File

@@ -130,16 +130,16 @@ impl Expression<'_> {
pub fn get_literal_value<T: Variant>(&self) -> Option<T> {
// Coded this way in order to maximally leverage potentials for dead-code removal.
match self.0 {
Expr::IntegerConstant(x, ..) => reify!(*x => Option<T>),
Expr::IntegerConstant(x, ..) => reify! { *x => Option<T> },
#[cfg(not(feature = "no_float"))]
Expr::FloatConstant(x, ..) => reify!(*x => Option<T>),
Expr::FloatConstant(x, ..) => reify! { *x => Option<T> },
Expr::CharConstant(x, ..) => reify!(*x => Option<T>),
Expr::StringConstant(x, ..) => reify!(x.clone() => Option<T>),
Expr::Variable(x, ..) => reify!(x.3.clone() => Option<T>),
Expr::BoolConstant(x, ..) => reify!(*x => Option<T>),
Expr::Unit(..) => reify!(() => Option<T>),
Expr::CharConstant(x, ..) => reify! { *x => Option<T> },
Expr::StringConstant(x, ..) => reify! { x.clone() => Option<T> },
Expr::Variable(x, ..) => reify! { x.3.clone() => Option<T> },
Expr::BoolConstant(x, ..) => reify! { *x => Option<T> },
Expr::Unit(..) => reify! { () => Option<T> },
_ => None,
}