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.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/crates/hir-def/src/hir.rs b/crates/hir-def/src/hir.rs
index 0dcddf162b..494644d8ef 100644
--- a/crates/hir-def/src/hir.rs
+++ b/crates/hir-def/src/hir.rs
@@ -55,12 +55,20 @@ impl ExprOrPatId {
}
}
+ pub fn is_expr(&self) -> bool {
+ matches!(self, Self::ExprId(_))
+ }
+
pub fn as_pat(self) -> Option<PatId> {
match self {
Self::PatId(v) => Some(v),
_ => None,
}
}
+
+ pub fn is_pat(&self) -> bool {
+ matches!(self, Self::PatId(_))
+ }
}
stdx::impl_from!(ExprId, PatId for ExprOrPatId);
@@ -571,8 +579,8 @@ pub enum Pat {
ellipsis: bool,
},
Range {
- start: Option<Box<LiteralOrConst>>,
- end: Option<Box<LiteralOrConst>>,
+ start: Option<ExprId>,
+ end: Option<ExprId>,
},
Slice {
prefix: Box<[PatId]>,