Fix full optimization.

This commit is contained in:
Stephen Chung
2022-10-30 23:33:44 +08:00
parent 32493524ed
commit 79ba80eeb3
2 changed files with 17 additions and 7 deletions

View File

@@ -261,6 +261,16 @@ impl FnCallExpr {
pub fn into_fn_call_expr(self, pos: Position) -> Expr {
Expr::FnCall(self.into(), pos)
}
/// Are all arguments constant?
#[inline]
#[must_use]
pub fn constant_args(&self) -> bool {
if self.args.is_empty() {
true
} else {
self.args.iter().all(Expr::is_constant)
}
}
}
/// A type that wraps a floating-point number and implements [`Hash`].