Fix highlighting of const patterns

This commit is contained in:
Aleksey Kladov 2020-02-28 16:36:14 +01:00
parent 209eb32796
commit 5ebfcb9cb7
5 changed files with 60 additions and 15 deletions

View file

@ -18,8 +18,8 @@ use crate::{
db::HirDatabase,
source_analyzer::{resolve_hir_path, ReferenceDescriptor, SourceAnalyzer},
source_binder::{ChildContainer, SourceBinder},
Function, HirFileId, InFile, Local, MacroDef, Module, Name, Origin, Path, PathResolution,
ScopeDef, StructField, Trait, Type, TypeParam, VariantDef,
Function, HirFileId, InFile, Local, MacroDef, Module, ModuleDef, Name, Origin, Path,
PathResolution, ScopeDef, StructField, Trait, Type, TypeParam, VariantDef,
};
use ra_prof::profile;
@ -129,6 +129,10 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> {
self.analyze(path.syntax()).resolve_path(self.db, path)
}
pub fn resolve_bind_pat_to_const(&self, pat: &ast::BindPat) -> Option<ModuleDef> {
self.analyze(pat.syntax()).resolve_bind_pat_to_const(self.db, pat)
}
// FIXME: use this instead?
// pub fn resolve_name_ref(&self, name_ref: &ast::NameRef) -> Option<???>;