This commit is contained in:
Aleksey Kladov 2019-04-11 15:51:02 +03:00
parent 6c2ba945ed
commit b6809b6695
10 changed files with 18 additions and 18 deletions

View file

@ -132,7 +132,7 @@ pub(crate) fn type_of(db: &RootDatabase, frange: FileRange) -> Option<String> {
.ancestors()
.take_while(|it| it.range() == leaf_node.range())
.find(|&it| ast::Expr::cast(it).is_some() || ast::Pat::cast(it).is_some())?;
let analyzer = hir::SourceAnalyser::new(db, frange.file_id, node);
let analyzer = hir::SourceAnalyzer::new(db, frange.file_id, node);
let ty = if let Some(ty) = ast::Expr::cast(node).and_then(|e| analyzer.type_of(db, e)) {
ty
} else if let Some(ty) = ast::Pat::cast(node).and_then(|p| analyzer.type_of_pat(db, p)) {