diff options
author | Lukas Wirth <[email protected]> | 2021-01-15 17:57:32 +0000 |
---|---|---|
committer | Lukas Wirth <[email protected]> | 2021-01-15 18:21:23 +0000 |
commit | cb863390f23bc2eac6561d55def9bd3ba54605fc (patch) | |
tree | b19b39d9b6231e8857a4096cc803cf35e2ddbe81 /crates/hir/src/semantics | |
parent | 0c58aa9dc0e24f0fa6a6ee7eb0c35041dedddb0a (diff) |
Handle self/super/crate in PathSegment as NameRef
Diffstat (limited to 'crates/hir/src/semantics')
-rw-r--r-- | crates/hir/src/semantics/source_to_def.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/hir/src/semantics/source_to_def.rs b/crates/hir/src/semantics/source_to_def.rs index 4b9ebff72..9bf60c72a 100644 --- a/crates/hir/src/semantics/source_to_def.rs +++ b/crates/hir/src/semantics/source_to_def.rs | |||
@@ -114,6 +114,15 @@ impl SourceToDefCtx<'_, '_> { | |||
114 | let pat_id = source_map.node_pat(src.as_ref())?; | 114 | let pat_id = source_map.node_pat(src.as_ref())?; |
115 | Some((container, pat_id)) | 115 | Some((container, pat_id)) |
116 | } | 116 | } |
117 | pub(super) fn self_param_to_def( | ||
118 | &mut self, | ||
119 | src: InFile<ast::SelfParam>, | ||
120 | ) -> Option<(DefWithBodyId, PatId)> { | ||
121 | let container = self.find_pat_or_label_container(src.as_ref().map(|it| it.syntax()))?; | ||
122 | let (_body, source_map) = self.db.body_with_source_map(container); | ||
123 | let pat_id = source_map.node_self_param(src.as_ref())?; | ||
124 | Some((container, pat_id)) | ||
125 | } | ||
117 | pub(super) fn label_to_def( | 126 | pub(super) fn label_to_def( |
118 | &mut self, | 127 | &mut self, |
119 | src: InFile<ast::Label>, | 128 | src: InFile<ast::Label>, |