fold ScopeWithSyntax into SourceAnalyzer

This commit is contained in:
Aleksey Kladov 2019-04-13 10:49:01 +03:00
parent 30481808fb
commit f4a94e74bc
7 changed files with 159 additions and 193 deletions

View file

@ -4,7 +4,7 @@ use ra_db::{CrateId, SourceRootId, Edition};
use ra_syntax::{ast::self, TreeArc};
use crate::{
Name, ScopesWithSourceMap, Ty, HirFileId, Either,
Name, Ty, HirFileId, Either,
HirDatabase, DefDatabase,
type_ref::TypeRef,
nameres::{ModuleScope, Namespace, ImportId, CrateModuleId},
@ -466,12 +466,6 @@ impl DefWithBody {
DefWithBody::Static(ref s) => s.resolver(db),
}
}
pub fn scopes(&self, db: &impl HirDatabase) -> ScopesWithSourceMap {
let scopes = db.expr_scopes(*self);
let source_map = db.body_with_source_map(*self).1;
ScopesWithSourceMap { scopes, source_map }
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
@ -535,12 +529,6 @@ impl Function {
db.type_for_def((*self).into(), Namespace::Values)
}
pub fn scopes(&self, db: &impl HirDatabase) -> ScopesWithSourceMap {
let scopes = db.expr_scopes((*self).into());
let source_map = db.body_with_source_map((*self).into()).1;
ScopesWithSourceMap { scopes, source_map }
}
pub fn signature(&self, db: &impl HirDatabase) -> Arc<FnSignature> {
db.fn_signature(*self)
}