aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_db/src
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-01-15 20:07:38 +0000
committerLukas Wirth <[email protected]>2021-01-15 21:18:43 +0000
commit98718e0544f42e55642d2838b00d6a7bef1e2414 (patch)
tree15d727f30f9dc3338203f8f70f19f8023133f382 /crates/ide_db/src
parent8a869e870ac6328967fb120a0ebe44a9c900eaf0 (diff)
Wrap remaining self/super/crate in Name{Ref}
Diffstat (limited to 'crates/ide_db/src')
-rw-r--r--crates/ide_db/src/defs.rs11
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)))