mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Simplify
This commit is contained in:
parent
44c8ddf885
commit
8ada1a2689
2 changed files with 4 additions and 6 deletions
|
@ -152,11 +152,9 @@ pub fn find_node_at_offset<'a, N: AstNode<'a>>(
|
|||
}
|
||||
|
||||
pub fn resolve_local_name(
|
||||
file: &File,
|
||||
offset: TextUnit,
|
||||
name_ref: ast::NameRef,
|
||||
) -> Option<(SmolStr, TextRange)> {
|
||||
let fn_def = find_node_at_offset::<ast::FnDef>(file.syntax(), offset)?;
|
||||
let fn_def = name_ref.syntax().ancestors().find_map(ast::FnDef::cast)?;
|
||||
let scopes = scope::FnScopes::new(fn_def);
|
||||
let scope_entry = scope::resolve_local_name(name_ref, &scopes)?;
|
||||
let name = scope_entry.ast().name()?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue