This commit is contained in:
Florian Diebold 2018-12-23 12:15:46 +01:00
parent 7348f7883f
commit 515c3bc59b
4 changed files with 110 additions and 108 deletions

View file

@ -516,8 +516,14 @@ impl AnalysisImpl {
let syntax = file.syntax();
let node = find_covering_node(syntax, range);
let parent_fn = node.ancestors().filter_map(FnDef::cast).next();
let parent_fn = if let Some(p) = parent_fn { p } else { return Ok(None) };
let function = ctry!(source_binder::function_from_source(&*self.db, file_id, parent_fn)?);
let parent_fn = if let Some(p) = parent_fn {
p
} else {
return Ok(None);
};
let function = ctry!(source_binder::function_from_source(
&*self.db, file_id, parent_fn
)?);
let infer = function.infer(&*self.db);
Ok(infer.type_of_node(node).map(|t| t.to_string()))
}