rename syntax_mapping as well

This commit is contained in:
Aleksey Kladov 2019-03-02 16:56:09 +03:00
parent 80bb7d86ec
commit 03b2ab8e1f
6 changed files with 18 additions and 19 deletions

View file

@ -132,10 +132,10 @@ pub(crate) fn type_of(db: &RootDatabase, frange: FileRange) -> Option<String> {
let parent_fn = node.ancestors().find_map(ast::FnDef::cast)?;
let function = hir::source_binder::function_from_source(db, frange.file_id, parent_fn)?;
let infer = function.infer(db);
let syntax_mapping = function.body_source_map(db);
if let Some(expr) = ast::Expr::cast(node).and_then(|e| syntax_mapping.node_expr(e)) {
let source_map = function.body_source_map(db);
if let Some(expr) = ast::Expr::cast(node).and_then(|e| source_map.node_expr(e)) {
Some(infer[expr].to_string())
} else if let Some(pat) = ast::Pat::cast(node).and_then(|p| syntax_mapping.node_pat(p)) {
} else if let Some(pat) = ast::Pat::cast(node).and_then(|p| source_map.node_pat(p)) {
Some(infer[pat].to_string())
} else {
None