rename ModuleDescriptor -> Module

This commit is contained in:
Aleksey Kladov 2018-11-28 01:19:55 +03:00
parent 16f67ee384
commit 36b1d20c16
5 changed files with 34 additions and 35 deletions

View file

@ -20,7 +20,8 @@ use crate::{
completion::{completions, CompletionItem},
db::{self, FileSyntaxQuery, SyntaxDatabase},
hir::{
FunctionDescriptor, FnSignatureInfo, ModuleDescriptor,
self,
FunctionDescriptor, FnSignatureInfo,
Problem,
},
input::{FilesDatabase, SourceRoot, SourceRootId, WORKSPACE},
@ -226,7 +227,7 @@ impl AnalysisImpl {
/// This return `Vec`: a module may be included from several places. We
/// don't handle this case yet though, so the Vec has length at most one.
pub fn parent_module(&self, position: FilePosition) -> Cancelable<Vec<(FileId, FileSymbol)>> {
let descr = match ModuleDescriptor::guess_from_position(&*self.db, position)? {
let descr = match hir::Module::guess_from_position(&*self.db, position)? {
None => return Ok(Vec::new()),
Some(it) => it,
};
@ -245,7 +246,7 @@ impl AnalysisImpl {
}
/// Returns `Vec` for the same reason as `parent_module`
pub fn crate_for(&self, file_id: FileId) -> Cancelable<Vec<CrateId>> {
let descr = match ModuleDescriptor::guess_from_file_id(&*self.db, file_id)? {
let descr = match hir::Module::guess_from_file_id(&*self.db, file_id)? {
None => return Ok(Vec::new()),
Some(it) => it,
};
@ -298,7 +299,7 @@ impl AnalysisImpl {
if let Some(module) = name.syntax().parent().and_then(ast::Module::cast) {
if module.has_semi() {
let parent_module =
ModuleDescriptor::guess_from_file_id(&*self.db, position.file_id)?;
hir::Module::guess_from_file_id(&*self.db, position.file_id)?;
let child_name = module.name();
match (parent_module, child_name) {
(Some(parent_module), Some(child_name)) => {
@ -380,7 +381,7 @@ impl AnalysisImpl {
fix: None,
})
.collect::<Vec<_>>();
if let Some(m) = ModuleDescriptor::guess_from_file_id(&*self.db, file_id)? {
if let Some(m) = hir::Module::guess_from_file_id(&*self.db, file_id)? {
for (name_node, problem) in m.problems(&*self.db) {
let diag = match problem {
Problem::UnresolvedModule { candidate } => {