mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Handle self/super/crate in PathSegment as NameRef
This commit is contained in:
parent
0c58aa9dc0
commit
cb863390f2
42 changed files with 258 additions and 254 deletions
|
@ -114,6 +114,15 @@ impl SourceToDefCtx<'_, '_> {
|
|||
let pat_id = source_map.node_pat(src.as_ref())?;
|
||||
Some((container, pat_id))
|
||||
}
|
||||
pub(super) fn self_param_to_def(
|
||||
&mut self,
|
||||
src: InFile<ast::SelfParam>,
|
||||
) -> Option<(DefWithBodyId, PatId)> {
|
||||
let container = self.find_pat_or_label_container(src.as_ref().map(|it| it.syntax()))?;
|
||||
let (_body, source_map) = self.db.body_with_source_map(container);
|
||||
let pat_id = source_map.node_self_param(src.as_ref())?;
|
||||
Some((container, pat_id))
|
||||
}
|
||||
pub(super) fn label_to_def(
|
||||
&mut self,
|
||||
src: InFile<ast::Label>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue