Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/hir.rs')
| -rw-r--r-- | crates/hir-def/src/hir.rs | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/crates/hir-def/src/hir.rs b/crates/hir-def/src/hir.rs index a42f8183ab..8102efdba3 100644 --- a/crates/hir-def/src/hir.rs +++ b/crates/hir-def/src/hir.rs @@ -96,6 +96,13 @@ pub enum Literal { Float(FloatTypeWrapper, Option<BuiltinFloat>), } +#[derive(Debug, Clone, Eq, PartialEq)] +/// Used in range patterns. +pub enum LiteralOrConst { + Literal(Literal), + Const(Path), +} + impl Literal { pub fn negate(self) -> Option<Self> { if let Literal::Int(i, k) = self { @@ -189,12 +196,6 @@ pub enum Expr { body: ExprId, label: Option<LabelId>, }, - For { - iterable: ExprId, - pat: PatId, - body: ExprId, - label: Option<LabelId>, - }, Call { callee: ExprId, args: Box<[ExprId]>, @@ -382,10 +383,6 @@ impl Expr { f(*condition); f(*body); } - Expr::For { iterable, body, .. } => { - f(*iterable); - f(*body); - } Expr::Call { callee, args, .. } => { f(*callee); args.iter().copied().for_each(f); @@ -526,7 +523,7 @@ pub enum Pat { Tuple { args: Box<[PatId]>, ellipsis: Option<usize> }, Or(Box<[PatId]>), Record { path: Option<Box<Path>>, args: Box<[RecordFieldPat]>, ellipsis: bool }, - Range { start: ExprId, end: ExprId }, + Range { start: Option<Box<LiteralOrConst>>, end: Option<Box<LiteralOrConst>> }, Slice { prefix: Box<[PatId]>, slice: Option<PatId>, suffix: Box<[PatId]> }, Path(Box<Path>), Lit(ExprId), |