diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-01-18 16:13:06 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-01-18 16:13:06 +0000 |
commit | 9daba961f236750c3a5d831c9775606271b37eff (patch) | |
tree | 6d8c037ea915434701e573bf5eb2eb1f696eef07 /crates/ide_db/src | |
parent | cc58459ee39db804c0b4a660d1f0bb5c9c0bb648 (diff) | |
parent | 98718e0544f42e55642d2838b00d6a7bef1e2414 (diff) |
Merge #7291
7291: Wrap remaining self/super/crate in Name{Ref} r=matklad a=Veykril
That should be the remaining special casing for `self` 🎉
Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/ide_db/src')
-rw-r--r-- | crates/ide_db/src/defs.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/crates/ide_db/src/defs.rs b/crates/ide_db/src/defs.rs index 231e886a9..d9875ffef 100644 --- a/crates/ide_db/src/defs.rs +++ b/crates/ide_db/src/defs.rs | |||
@@ -117,13 +117,6 @@ impl NameClass { | |||
117 | } | 117 | } |
118 | } | 118 | } |
119 | 119 | ||
120 | pub fn classify_self_param( | ||
121 | sema: &Semantics<RootDatabase>, | ||
122 | self_param: &ast::SelfParam, | ||
123 | ) -> Option<NameClass> { | ||
124 | sema.to_def(self_param).map(Definition::Local).map(NameClass::Definition) | ||
125 | } | ||
126 | |||
127 | pub fn classify(sema: &Semantics<RootDatabase>, name: &ast::Name) -> Option<NameClass> { | 120 | pub fn classify(sema: &Semantics<RootDatabase>, name: &ast::Name) -> Option<NameClass> { |
128 | let _p = profile::span("classify_name"); | 121 | let _p = profile::span("classify_name"); |
129 | 122 | ||
@@ -186,6 +179,10 @@ impl NameClass { | |||
186 | 179 | ||
187 | Some(NameClass::Definition(Definition::Local(local))) | 180 | Some(NameClass::Definition(Definition::Local(local))) |
188 | }, | 181 | }, |
182 | ast::SelfParam(it) => { | ||
183 | let def = sema.to_def(&it)?; | ||
184 | Some(NameClass::Definition(Definition::Local(def.into()))) | ||
185 | }, | ||
189 | ast::RecordField(it) => { | 186 | ast::RecordField(it) => { |
190 | let field: hir::Field = sema.to_def(&it)?; | 187 | let field: hir::Field = sema.to_def(&it)?; |
191 | Some(NameClass::Definition(Definition::Field(field))) | 188 | Some(NameClass::Definition(Definition::Field(field))) |