aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-07-31 19:12:38 +0100
committerGitHub <[email protected]>2020-07-31 19:12:38 +0100
commit38ab326aac70484cb951fe9389d788d525d41550 (patch)
tree0032223efeefca76340fb0a97f6f12d0e432a2a9 /crates/ra_hir/src
parent5cade89d730b025082ff2df70aace259951a9ccf (diff)
parent98181087984157e27faba0b969e384f3c62c39d5 (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_hir/src')
-rw-r--r--crates/ra_hir/src/code_model.rs2
-rw-r--r--crates/ra_hir/src/semantics.rs10
-rw-r--r--crates/ra_hir/src/semantics/source_to_def.rs2
-rw-r--r--crates/ra_hir/src/source_analyzer.rs4
4 files changed, 9 insertions, 9 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs
index 36c0bdc9e..27cdabea0 100644
--- a/crates/ra_hir/src/code_model.rs
+++ b/crates/ra_hir/src/code_model.rs
@@ -1002,7 +1002,7 @@ impl Local {
1002 Type::new(db, krate, def, ty) 1002 Type::new(db, krate, def, ty)
1003 } 1003 }
1004 1004
1005 pub fn source(self, db: &dyn HirDatabase) -> InFile<Either<ast::BindPat, ast::SelfParam>> { 1005 pub fn source(self, db: &dyn HirDatabase) -> InFile<Either<ast::IdentPat, ast::SelfParam>> {
1006 let (_body, source_map) = db.body_with_source_map(self.parent.into()); 1006 let (_body, source_map) = db.body_with_source_map(self.parent.into());
1007 let src = source_map.pat_syntax(self.pat_id).unwrap(); // Hmm... 1007 let src = source_map.pat_syntax(self.pat_id).unwrap(); // Hmm...
1008 let root = src.file_syntax(db.upcast()); 1008 let root = src.file_syntax(db.upcast());
diff --git a/crates/ra_hir/src/semantics.rs b/crates/ra_hir/src/semantics.rs
index 6f3b3dc9a..307b336f2 100644
--- a/crates/ra_hir/src/semantics.rs
+++ b/crates/ra_hir/src/semantics.rs
@@ -216,7 +216,7 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> {
216 self.imp.resolve_record_field(field) 216 self.imp.resolve_record_field(field)
217 } 217 }
218 218
219 pub fn resolve_record_field_pat(&self, field: &ast::RecordFieldPat) -> Option<Field> { 219 pub fn resolve_record_field_pat(&self, field: &ast::RecordPatField) -> Option<Field> {
220 self.imp.resolve_record_field_pat(field) 220 self.imp.resolve_record_field_pat(field)
221 } 221 }
222 222
@@ -236,7 +236,7 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> {
236 self.imp.lower_path(path) 236 self.imp.lower_path(path)
237 } 237 }
238 238
239 pub fn resolve_bind_pat_to_const(&self, pat: &ast::BindPat) -> Option<ModuleDef> { 239 pub fn resolve_bind_pat_to_const(&self, pat: &ast::IdentPat) -> Option<ModuleDef> {
240 self.imp.resolve_bind_pat_to_const(pat) 240 self.imp.resolve_bind_pat_to_const(pat)
241 } 241 }
242 242
@@ -429,7 +429,7 @@ impl<'db> SemanticsImpl<'db> {
429 self.analyze(field.syntax()).resolve_record_field(self.db, field) 429 self.analyze(field.syntax()).resolve_record_field(self.db, field)
430 } 430 }
431 431
432 fn resolve_record_field_pat(&self, field: &ast::RecordFieldPat) -> Option<Field> { 432 fn resolve_record_field_pat(&self, field: &ast::RecordPatField) -> Option<Field> {
433 self.analyze(field.syntax()).resolve_record_field_pat(self.db, field) 433 self.analyze(field.syntax()).resolve_record_field_pat(self.db, field)
434 } 434 }
435 435
@@ -452,7 +452,7 @@ impl<'db> SemanticsImpl<'db> {
452 Path::from_src(path.clone(), &Hygiene::new(self.db.upcast(), src.file_id.into())) 452 Path::from_src(path.clone(), &Hygiene::new(self.db.upcast(), src.file_id.into()))
453 } 453 }
454 454
455 fn resolve_bind_pat_to_const(&self, pat: &ast::BindPat) -> Option<ModuleDef> { 455 fn resolve_bind_pat_to_const(&self, pat: &ast::IdentPat) -> Option<ModuleDef> {
456 self.analyze(pat.syntax()).resolve_bind_pat_to_const(self.db, pat) 456 self.analyze(pat.syntax()).resolve_bind_pat_to_const(self.db, pat)
457 } 457 }
458 458
@@ -594,7 +594,7 @@ to_def_impls![
594 (crate::EnumVariant, ast::Variant, enum_variant_to_def), 594 (crate::EnumVariant, ast::Variant, enum_variant_to_def),
595 (crate::TypeParam, ast::TypeParam, type_param_to_def), 595 (crate::TypeParam, ast::TypeParam, type_param_to_def),
596 (crate::MacroDef, ast::MacroCall, macro_call_to_def), // this one is dubious, not all calls are macros 596 (crate::MacroDef, ast::MacroCall, macro_call_to_def), // this one is dubious, not all calls are macros
597 (crate::Local, ast::BindPat, bind_pat_to_def), 597 (crate::Local, ast::IdentPat, bind_pat_to_def),
598]; 598];
599 599
600fn find_root(node: &SyntaxNode) -> SyntaxNode { 600fn find_root(node: &SyntaxNode) -> SyntaxNode {
diff --git a/crates/ra_hir/src/semantics/source_to_def.rs b/crates/ra_hir/src/semantics/source_to_def.rs
index d1994e2e7..863e8e5ff 100644
--- a/crates/ra_hir/src/semantics/source_to_def.rs
+++ b/crates/ra_hir/src/semantics/source_to_def.rs
@@ -106,7 +106,7 @@ impl SourceToDefCtx<'_, '_> {
106 } 106 }
107 pub(super) fn bind_pat_to_def( 107 pub(super) fn bind_pat_to_def(
108 &mut self, 108 &mut self,
109 src: InFile<ast::BindPat>, 109 src: InFile<ast::IdentPat>,
110 ) -> Option<(DefWithBodyId, PatId)> { 110 ) -> Option<(DefWithBodyId, PatId)> {
111 let container = self.find_pat_container(src.as_ref().map(|it| it.syntax()))?; 111 let container = self.find_pat_container(src.as_ref().map(|it| it.syntax()))?;
112 let (_body, source_map) = self.db.body_with_source_map(container); 112 let (_body, source_map) = self.db.body_with_source_map(container);
diff --git a/crates/ra_hir/src/source_analyzer.rs b/crates/ra_hir/src/source_analyzer.rs
index f2e630ef1..d0cb62ef0 100644
--- a/crates/ra_hir/src/source_analyzer.rs
+++ b/crates/ra_hir/src/source_analyzer.rs
@@ -182,7 +182,7 @@ impl SourceAnalyzer {
182 pub(crate) fn resolve_record_field_pat( 182 pub(crate) fn resolve_record_field_pat(
183 &self, 183 &self,
184 _db: &dyn HirDatabase, 184 _db: &dyn HirDatabase,
185 field: &ast::RecordFieldPat, 185 field: &ast::RecordPatField,
186 ) -> Option<Field> { 186 ) -> Option<Field> {
187 let pat_id = self.pat_id(&field.pat()?)?; 187 let pat_id = self.pat_id(&field.pat()?)?;
188 let struct_field = self.infer.as_ref()?.record_field_pat_resolution(pat_id)?; 188 let struct_field = self.infer.as_ref()?.record_field_pat_resolution(pat_id)?;
@@ -202,7 +202,7 @@ impl SourceAnalyzer {
202 pub(crate) fn resolve_bind_pat_to_const( 202 pub(crate) fn resolve_bind_pat_to_const(
203 &self, 203 &self,
204 db: &dyn HirDatabase, 204 db: &dyn HirDatabase,
205 pat: &ast::BindPat, 205 pat: &ast::IdentPat,
206 ) -> Option<ModuleDef> { 206 ) -> Option<ModuleDef> {
207 let pat_id = self.pat_id(&pat.clone().into())?; 207 let pat_id = self.pat_id(&pat.clone().into())?;
208 let body = self.body.as_ref()?; 208 let body = self.body.as_ref()?;