-
Notifications
You must be signed in to change notification settings - Fork 107
Removing error
extension function
#874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -321,6 +321,13 @@ impl Expr { | |
ExprBuilder::new().ite(test_expr, then_expr, else_expr) | ||
} | ||
|
||
/// Create a ternary (if-then-else) `Expr`. | ||
/// Takes `Arc`s instead of owned `Expr`s | ||
/// `test_expr` must evaluate to a Bool type | ||
pub fn ite_arc(test_expr: Arc<Expr>, then_expr: Arc<Expr>, else_expr: Arc<Expr>) -> Self { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: can we make it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rest of the functions are not There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the signature of this function is not idiomatic as public functions. I was thinking another function as well but just commented on this one. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is just |
||
ExprBuilder::new().ite_arc(test_expr, then_expr, else_expr) | ||
} | ||
|
||
/// Create a 'not' expression. `e` must evaluate to Bool type | ||
pub fn not(e: Expr) -> Self { | ||
ExprBuilder::new().not(e) | ||
|
@@ -827,6 +834,22 @@ impl<T> ExprBuilder<T> { | |
}) | ||
} | ||
|
||
/// Create a ternary (if-then-else) `Expr`. | ||
/// Takes `Arc`s instead of owned `Expr`s | ||
aaronjeline marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
/// `test_expr` must evaluate to a Bool type | ||
pub fn ite_arc( | ||
self, | ||
test_expr: Arc<Expr<T>>, | ||
then_expr: Arc<Expr<T>>, | ||
else_expr: Arc<Expr<T>>, | ||
) -> Expr<T> { | ||
self.with_expr_kind(ExprKind::If { | ||
test_expr, | ||
then_expr, | ||
else_expr, | ||
}) | ||
} | ||
|
||
/// Create a 'not' expression. `e` must evaluate to Bool type | ||
pub fn not(self, e: Expr<T>) -> Expr<T> { | ||
self.with_expr_kind(ExprKind::UnaryApp { | ||
|
Uh oh!
There was an error while loading. Please reload this page.