This commit is contained in:
Aleksey Kladov 2019-01-08 18:43:29 +03:00
parent db794abe66
commit 6f02f176c8

View file

@ -21,12 +21,11 @@ pub(crate) fn call_info(db: &RootDatabase, position: FilePosition) -> Cancelable
// Resolve the function's NameRef (NOTE: this isn't entirely accurate). // Resolve the function's NameRef (NOTE: this isn't entirely accurate).
let file_symbols = db.index_resolve(name_ref)?; let file_symbols = db.index_resolve(name_ref)?;
for symbol in file_symbols { let symbol = ctry!(file_symbols.into_iter().find(|it| it.ptr.kind() == FN_DEF));
if symbol.ptr.kind() == FN_DEF {
let fn_file = db.source_file(symbol.file_id); let fn_file = db.source_file(symbol.file_id);
let fn_def = symbol.ptr.resolve(&fn_file); let fn_def = symbol.ptr.resolve(&fn_file);
let fn_def = ast::FnDef::cast(&fn_def).unwrap(); let fn_def = ast::FnDef::cast(&fn_def).unwrap();
if let Some(mut call_info) = CallInfo::new(fn_def) { let mut call_info = ctry!(CallInfo::new(fn_def));
// If we have a calling expression let's find which argument we are on // If we have a calling expression let's find which argument we are on
let num_params = call_info.parameters.len(); let num_params = call_info.parameters.len();
let has_self = fn_def.param_list().and_then(|l| l.self_param()).is_some(); let has_self = fn_def.param_list().and_then(|l| l.self_param()).is_some();
@ -62,12 +61,7 @@ pub(crate) fn call_info(db: &RootDatabase, position: FilePosition) -> Cancelable
} }
} }
return Ok(Some(call_info)); Ok(Some(call_info))
}
}
}
Ok(None)
} }
enum FnCallNode<'a> { enum FnCallNode<'a> {