aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-07-30 17:02:20 +0100
committerAleksey Kladov <[email protected]>2020-07-30 17:02:20 +0100
commit3cd4112bdc924c132cb0eab9d064511a215421ec (patch)
treef651b475d9c799a772fd37e89405f80a04ea953e /crates/ra_hir
parent6b25f640a6ad8e2322b5cc0664223b742459336d (diff)
Finalize const&static grammar
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/has_source.rs8
-rw-r--r--crates/ra_hir/src/semantics.rs4
-rw-r--r--crates/ra_hir/src/semantics/source_to_def.rs12
3 files changed, 12 insertions, 12 deletions
diff --git a/crates/ra_hir/src/has_source.rs b/crates/ra_hir/src/has_source.rs
index 1c5747581..9581552e5 100644
--- a/crates/ra_hir/src/has_source.rs
+++ b/crates/ra_hir/src/has_source.rs
@@ -87,14 +87,14 @@ impl HasSource for Function {
87 } 87 }
88} 88}
89impl HasSource for Const { 89impl HasSource for Const {
90 type Ast = ast::ConstDef; 90 type Ast = ast::Const;
91 fn source(self, db: &dyn HirDatabase) -> InFile<ast::ConstDef> { 91 fn source(self, db: &dyn HirDatabase) -> InFile<ast::Const> {
92 self.id.lookup(db.upcast()).source(db.upcast()) 92 self.id.lookup(db.upcast()).source(db.upcast())
93 } 93 }
94} 94}
95impl HasSource for Static { 95impl HasSource for Static {
96 type Ast = ast::StaticDef; 96 type Ast = ast::Static;
97 fn source(self, db: &dyn HirDatabase) -> InFile<ast::StaticDef> { 97 fn source(self, db: &dyn HirDatabase) -> InFile<ast::Static> {
98 self.id.lookup(db.upcast()).source(db.upcast()) 98 self.id.lookup(db.upcast()).source(db.upcast())
99 } 99 }
100} 100}
diff --git a/crates/ra_hir/src/semantics.rs b/crates/ra_hir/src/semantics.rs
index e18df2537..32a60b789 100644
--- a/crates/ra_hir/src/semantics.rs
+++ b/crates/ra_hir/src/semantics.rs
@@ -586,8 +586,8 @@ to_def_impls![
586 (crate::Trait, ast::TraitDef, trait_to_def), 586 (crate::Trait, ast::TraitDef, trait_to_def),
587 (crate::ImplDef, ast::ImplDef, impl_to_def), 587 (crate::ImplDef, ast::ImplDef, impl_to_def),
588 (crate::TypeAlias, ast::TypeAlias, type_alias_to_def), 588 (crate::TypeAlias, ast::TypeAlias, type_alias_to_def),
589 (crate::Const, ast::ConstDef, const_to_def), 589 (crate::Const, ast::Const, const_to_def),
590 (crate::Static, ast::StaticDef, static_to_def), 590 (crate::Static, ast::Static, static_to_def),
591 (crate::Function, ast::Fn, fn_to_def), 591 (crate::Function, ast::Fn, fn_to_def),
592 (crate::Field, ast::RecordField, record_field_to_def), 592 (crate::Field, ast::RecordField, record_field_to_def),
593 (crate::Field, ast::TupleField, tuple_field_to_def), 593 (crate::Field, ast::TupleField, tuple_field_to_def),
diff --git a/crates/ra_hir/src/semantics/source_to_def.rs b/crates/ra_hir/src/semantics/source_to_def.rs
index b85a12680..782a03f9e 100644
--- a/crates/ra_hir/src/semantics/source_to_def.rs
+++ b/crates/ra_hir/src/semantics/source_to_def.rs
@@ -83,10 +83,10 @@ impl SourceToDefCtx<'_, '_> {
83 pub(super) fn union_to_def(&mut self, src: InFile<ast::Union>) -> Option<UnionId> { 83 pub(super) fn union_to_def(&mut self, src: InFile<ast::Union>) -> Option<UnionId> {
84 self.to_def(src, keys::UNION) 84 self.to_def(src, keys::UNION)
85 } 85 }
86 pub(super) fn static_to_def(&mut self, src: InFile<ast::StaticDef>) -> Option<StaticId> { 86 pub(super) fn static_to_def(&mut self, src: InFile<ast::Static>) -> Option<StaticId> {
87 self.to_def(src, keys::STATIC) 87 self.to_def(src, keys::STATIC)
88 } 88 }
89 pub(super) fn const_to_def(&mut self, src: InFile<ast::ConstDef>) -> Option<ConstId> { 89 pub(super) fn const_to_def(&mut self, src: InFile<ast::Const>) -> Option<ConstId> {
90 self.to_def(src, keys::CONST) 90 self.to_def(src, keys::CONST)
91 } 91 }
92 pub(super) fn type_alias_to_def(&mut self, src: InFile<ast::TypeAlias>) -> Option<TypeAliasId> { 92 pub(super) fn type_alias_to_def(&mut self, src: InFile<ast::TypeAlias>) -> Option<TypeAliasId> {
@@ -178,11 +178,11 @@ impl SourceToDefCtx<'_, '_> {
178 let def = self.union_to_def(container.with_value(it))?; 178 let def = self.union_to_def(container.with_value(it))?;
179 VariantId::from(def).into() 179 VariantId::from(def).into()
180 }, 180 },
181 ast::StaticDef(it) => { 181 ast::Static(it) => {
182 let def = self.static_to_def(container.with_value(it))?; 182 let def = self.static_to_def(container.with_value(it))?;
183 DefWithBodyId::from(def).into() 183 DefWithBodyId::from(def).into()
184 }, 184 },
185 ast::ConstDef(it) => { 185 ast::Const(it) => {
186 let def = self.const_to_def(container.with_value(it))?; 186 let def = self.const_to_def(container.with_value(it))?;
187 DefWithBodyId::from(def).into() 187 DefWithBodyId::from(def).into()
188 }, 188 },
@@ -222,8 +222,8 @@ impl SourceToDefCtx<'_, '_> {
222 for container in src.cloned().ancestors_with_macros(self.db.upcast()).skip(1) { 222 for container in src.cloned().ancestors_with_macros(self.db.upcast()).skip(1) {
223 let res: DefWithBodyId = match_ast! { 223 let res: DefWithBodyId = match_ast! {
224 match (container.value) { 224 match (container.value) {
225 ast::ConstDef(it) => self.const_to_def(container.with_value(it))?.into(), 225 ast::Const(it) => self.const_to_def(container.with_value(it))?.into(),
226 ast::StaticDef(it) => self.static_to_def(container.with_value(it))?.into(), 226 ast::Static(it) => self.static_to_def(container.with_value(it))?.into(),
227 ast::Fn(it) => self.fn_to_def(container.with_value(it))?.into(), 227 ast::Fn(it) => self.fn_to_def(container.with_value(it))?.into(),
228 _ => continue, 228 _ => continue,
229 } 229 }