mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
semantic highlighting: add reference hlmod
This commit is contained in:
parent
14f00adcb1
commit
2baef17bb1
15 changed files with 68 additions and 38 deletions
|
@ -1840,6 +1840,11 @@ impl Local {
|
|||
matches!(&body[self.pat_id], Pat::Bind { mode: BindingAnnotation::Mutable, .. })
|
||||
}
|
||||
|
||||
pub fn is_ref(self, db: &dyn HirDatabase) -> bool {
|
||||
let body = db.body(self.parent);
|
||||
matches!(&body[self.pat_id], Pat::Bind { mode: BindingAnnotation::Ref, .. })
|
||||
}
|
||||
|
||||
pub fn parent(self, _db: &dyn HirDatabase) -> DefWithBody {
|
||||
self.parent.into()
|
||||
}
|
||||
|
@ -2195,6 +2200,10 @@ impl Type {
|
|||
matches!(self.ty.kind(&Interner), TyKind::Ref(hir_ty::Mutability::Mut, ..))
|
||||
}
|
||||
|
||||
pub fn is_reference(&self) -> bool {
|
||||
matches!(self.ty.kind(&Interner), TyKind::Ref(hir_ty::Mutability::Not, ..))
|
||||
}
|
||||
|
||||
pub fn is_usize(&self) -> bool {
|
||||
matches!(self.ty.kind(&Interner), TyKind::Scalar(Scalar::Uint(UintTy::Usize)))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue