diff options
author | Aleksey Kladov <[email protected]> | 2020-07-30 17:17:28 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-07-30 17:17:28 +0100 |
commit | c83467796b6c7365ea4f41900d74444384a9e618 (patch) | |
tree | 6eb770e4c9751813cc0530e7c645fed8914eed12 /crates/ra_hir | |
parent | b2cdb0b22631a66a00be25ba4b2e9c0b34ff426a (diff) |
Finalize Trait grammar
Diffstat (limited to 'crates/ra_hir')
-rw-r--r-- | crates/ra_hir/src/has_source.rs | 6 | ||||
-rw-r--r-- | crates/ra_hir/src/semantics.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/semantics/source_to_def.rs | 6 |
3 files changed, 7 insertions, 7 deletions
diff --git a/crates/ra_hir/src/has_source.rs b/crates/ra_hir/src/has_source.rs index 9581552e5..057f6e32f 100644 --- a/crates/ra_hir/src/has_source.rs +++ b/crates/ra_hir/src/has_source.rs | |||
@@ -99,8 +99,8 @@ impl HasSource for Static { | |||
99 | } | 99 | } |
100 | } | 100 | } |
101 | impl HasSource for Trait { | 101 | impl HasSource for Trait { |
102 | type Ast = ast::TraitDef; | 102 | type Ast = ast::Trait; |
103 | fn source(self, db: &dyn HirDatabase) -> InFile<ast::TraitDef> { | 103 | fn source(self, db: &dyn HirDatabase) -> InFile<ast::Trait> { |
104 | self.id.lookup(db.upcast()).source(db.upcast()) | 104 | self.id.lookup(db.upcast()).source(db.upcast()) |
105 | } | 105 | } |
106 | } | 106 | } |
@@ -127,7 +127,7 @@ impl HasSource for ImplDef { | |||
127 | } | 127 | } |
128 | 128 | ||
129 | impl HasSource for TypeParam { | 129 | impl HasSource for TypeParam { |
130 | type Ast = Either<ast::TraitDef, ast::TypeParam>; | 130 | type Ast = Either<ast::Trait, ast::TypeParam>; |
131 | fn source(self, db: &dyn HirDatabase) -> InFile<Self::Ast> { | 131 | fn source(self, db: &dyn HirDatabase) -> InFile<Self::Ast> { |
132 | let child_source = self.id.parent.child_source(db.upcast()); | 132 | let child_source = self.id.parent.child_source(db.upcast()); |
133 | child_source.map(|it| it[self.id.local_id].clone()) | 133 | child_source.map(|it| it[self.id.local_id].clone()) |
diff --git a/crates/ra_hir/src/semantics.rs b/crates/ra_hir/src/semantics.rs index 32a60b789..5f5104dab 100644 --- a/crates/ra_hir/src/semantics.rs +++ b/crates/ra_hir/src/semantics.rs | |||
@@ -583,7 +583,7 @@ to_def_impls![ | |||
583 | (crate::Struct, ast::Struct, struct_to_def), | 583 | (crate::Struct, ast::Struct, struct_to_def), |
584 | (crate::Enum, ast::Enum, enum_to_def), | 584 | (crate::Enum, ast::Enum, enum_to_def), |
585 | (crate::Union, ast::Union, union_to_def), | 585 | (crate::Union, ast::Union, union_to_def), |
586 | (crate::Trait, ast::TraitDef, trait_to_def), | 586 | (crate::Trait, ast::Trait, 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::Const, const_to_def), | 589 | (crate::Const, ast::Const, const_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 782a03f9e..ae41d3ddf 100644 --- a/crates/ra_hir/src/semantics/source_to_def.rs +++ b/crates/ra_hir/src/semantics/source_to_def.rs | |||
@@ -65,7 +65,7 @@ impl SourceToDefCtx<'_, '_> { | |||
65 | Some(ModuleId { krate: parent_module.krate, local_id: child_id }) | 65 | Some(ModuleId { krate: parent_module.krate, local_id: child_id }) |
66 | } | 66 | } |
67 | 67 | ||
68 | pub(super) fn trait_to_def(&mut self, src: InFile<ast::TraitDef>) -> Option<TraitId> { | 68 | pub(super) fn trait_to_def(&mut self, src: InFile<ast::Trait>) -> Option<TraitId> { |
69 | self.to_def(src, keys::TRAIT) | 69 | self.to_def(src, keys::TRAIT) |
70 | } | 70 | } |
71 | pub(super) fn impl_to_def(&mut self, src: InFile<ast::ImplDef>) -> Option<ImplId> { | 71 | pub(super) fn impl_to_def(&mut self, src: InFile<ast::ImplDef>) -> Option<ImplId> { |
@@ -154,7 +154,7 @@ impl SourceToDefCtx<'_, '_> { | |||
154 | let def = self.module_to_def(container.with_value(it))?; | 154 | let def = self.module_to_def(container.with_value(it))?; |
155 | def.into() | 155 | def.into() |
156 | }, | 156 | }, |
157 | ast::TraitDef(it) => { | 157 | ast::Trait(it) => { |
158 | let def = self.trait_to_def(container.with_value(it))?; | 158 | let def = self.trait_to_def(container.with_value(it))?; |
159 | def.into() | 159 | def.into() |
160 | }, | 160 | }, |
@@ -207,7 +207,7 @@ impl SourceToDefCtx<'_, '_> { | |||
207 | ast::Fn(it) => self.fn_to_def(container.with_value(it))?.into(), | 207 | ast::Fn(it) => self.fn_to_def(container.with_value(it))?.into(), |
208 | ast::Struct(it) => self.struct_to_def(container.with_value(it))?.into(), | 208 | ast::Struct(it) => self.struct_to_def(container.with_value(it))?.into(), |
209 | ast::Enum(it) => self.enum_to_def(container.with_value(it))?.into(), | 209 | ast::Enum(it) => self.enum_to_def(container.with_value(it))?.into(), |
210 | ast::TraitDef(it) => self.trait_to_def(container.with_value(it))?.into(), | 210 | ast::Trait(it) => self.trait_to_def(container.with_value(it))?.into(), |
211 | ast::TypeAlias(it) => self.type_alias_to_def(container.with_value(it))?.into(), | 211 | ast::TypeAlias(it) => self.type_alias_to_def(container.with_value(it))?.into(), |
212 | ast::ImplDef(it) => self.impl_to_def(container.with_value(it))?.into(), | 212 | ast::ImplDef(it) => self.impl_to_def(container.with_value(it))?.into(), |
213 | _ => continue, | 213 | _ => continue, |