Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/expr.rs')
| -rw-r--r-- | crates/hir-def/src/expr.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/crates/hir-def/src/expr.rs b/crates/hir-def/src/expr.rs index 19fa6b2541..7ede19cc3c 100644 --- a/crates/hir-def/src/expr.rs +++ b/crates/hir-def/src/expr.rs @@ -92,6 +92,16 @@ pub enum Literal { Float(FloatTypeWrapper, Option<BuiltinFloat>), } +impl Literal { + pub fn negate(self) -> Option<Self> { + if let Literal::Int(i, k) = self { + Some(Literal::Int(-i, k)) + } else { + None + } + } +} + #[derive(Debug, Clone, Eq, PartialEq)] pub enum Expr { /// This is produced if the syntax tree does not have a required expression piece. @@ -112,11 +122,6 @@ pub enum Expr { tail: Option<ExprId>, label: Option<LabelId>, }, - TryBlock { - id: BlockId, - statements: Box<[Statement]>, - tail: Option<ExprId>, - }, Async { id: BlockId, statements: Box<[Statement]>, @@ -192,9 +197,6 @@ pub enum Expr { Await { expr: ExprId, }, - Try { - expr: ExprId, - }, Cast { expr: ExprId, type_ref: Interned<TypeRef>, @@ -303,7 +305,6 @@ impl Expr { f(*expr); } Expr::Block { statements, tail, .. } - | Expr::TryBlock { statements, tail, .. } | Expr::Unsafe { statements, tail, .. } | Expr::Async { statements, tail, .. } | Expr::Const { statements, tail, .. } => { @@ -383,7 +384,6 @@ impl Expr { } Expr::Field { expr, .. } | Expr::Await { expr } - | Expr::Try { expr } | Expr::Cast { expr, .. } | Expr::Ref { expr, .. } | Expr::UnaryOp { expr, .. } |