diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-07-31 19:12:38 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-31 19:12:38 +0100 |
commit | 38ab326aac70484cb951fe9389d788d525d41550 (patch) | |
tree | 0032223efeefca76340fb0a97f6f12d0e432a2a9 /crates/ra_ide_db/src/defs.rs | |
parent | 5cade89d730b025082ff2df70aace259951a9ccf (diff) | |
parent | 98181087984157e27faba0b969e384f3c62c39d5 (diff) |
Merge #5631
5631: Finalize pattern grammar r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide_db/src/defs.rs')
-rw-r--r-- | crates/ra_ide_db/src/defs.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs index df56f2d9e..66c048714 100644 --- a/crates/ra_ide_db/src/defs.rs +++ b/crates/ra_ide_db/src/defs.rs | |||
@@ -111,7 +111,7 @@ pub fn classify_name(sema: &Semantics<RootDatabase>, name: &ast::Name) -> Option | |||
111 | 111 | ||
112 | let parent = name.syntax().parent()?; | 112 | let parent = name.syntax().parent()?; |
113 | 113 | ||
114 | if let Some(bind_pat) = ast::BindPat::cast(parent.clone()) { | 114 | if let Some(bind_pat) = ast::IdentPat::cast(parent.clone()) { |
115 | if let Some(def) = sema.resolve_bind_pat_to_const(&bind_pat) { | 115 | if let Some(def) = sema.resolve_bind_pat_to_const(&bind_pat) { |
116 | return Some(NameClass::ConstReference(Definition::ModuleDef(def))); | 116 | return Some(NameClass::ConstReference(Definition::ModuleDef(def))); |
117 | } | 117 | } |
@@ -128,10 +128,10 @@ pub fn classify_name(sema: &Semantics<RootDatabase>, name: &ast::Name) -> Option | |||
128 | 128 | ||
129 | Some(NameClass::Definition(name_ref_class.definition())) | 129 | Some(NameClass::Definition(name_ref_class.definition())) |
130 | }, | 130 | }, |
131 | ast::BindPat(it) => { | 131 | ast::IdentPat(it) => { |
132 | let local = sema.to_def(&it)?; | 132 | let local = sema.to_def(&it)?; |
133 | 133 | ||
134 | if let Some(record_field_pat) = it.syntax().parent().and_then(ast::RecordFieldPat::cast) { | 134 | if let Some(record_field_pat) = it.syntax().parent().and_then(ast::RecordPatField::cast) { |
135 | if record_field_pat.name_ref().is_none() { | 135 | if record_field_pat.name_ref().is_none() { |
136 | if let Some(field) = sema.resolve_record_field_pat(&record_field_pat) { | 136 | if let Some(field) = sema.resolve_record_field_pat(&record_field_pat) { |
137 | let field = Definition::Field(field); | 137 | let field = Definition::Field(field); |
@@ -247,7 +247,7 @@ pub fn classify_name_ref( | |||
247 | } | 247 | } |
248 | } | 248 | } |
249 | 249 | ||
250 | if let Some(record_field_pat) = ast::RecordFieldPat::cast(parent.clone()) { | 250 | if let Some(record_field_pat) = ast::RecordPatField::cast(parent.clone()) { |
251 | if let Some(field) = sema.resolve_record_field_pat(&record_field_pat) { | 251 | if let Some(field) = sema.resolve_record_field_pat(&record_field_pat) { |
252 | let field = Definition::Field(field); | 252 | let field = Definition::Field(field); |
253 | return Some(NameRefClass::Definition(field)); | 253 | return Some(NameRefClass::Definition(field)); |