Handle self/super/crate in PathSegment as NameRef

This commit is contained in:
Lukas Wirth 2021-01-15 18:57:32 +01:00
parent 0c58aa9dc0
commit cb863390f2
42 changed files with 258 additions and 254 deletions

View file

@ -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>,