diff options
author | Aleksey Kladov <[email protected]> | 2019-12-07 19:09:53 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-12-07 19:25:48 +0000 |
commit | 88c5b1282a5770097c6c768b24bedfc3a6944e08 (patch) | |
tree | 913c24e889f3db8044b4b9f11bc3969e7eb02e34 /crates/ra_hir/src | |
parent | f4f8b8147426b0096d4b5126e487caaa13d13c27 (diff) |
Rename GenericParam -> TypeParam
We don't have LifetimeParam yet, but they are planned!
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r-- | crates/ra_hir/src/code_model.rs | 16 | ||||
-rw-r--r-- | crates/ra_hir/src/code_model/src.rs | 6 | ||||
-rw-r--r-- | crates/ra_hir/src/from_source.rs | 8 | ||||
-rw-r--r-- | crates/ra_hir/src/lib.rs | 6 | ||||
-rw-r--r-- | crates/ra_hir/src/source_binder.rs | 10 |
5 files changed, 23 insertions, 23 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 0295eb948..4578a0ba8 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs | |||
@@ -15,9 +15,9 @@ use hir_def::{ | |||
15 | per_ns::PerNs, | 15 | per_ns::PerNs, |
16 | resolver::HasResolver, | 16 | resolver::HasResolver, |
17 | type_ref::{Mutability, TypeRef}, | 17 | type_ref::{Mutability, TypeRef}, |
18 | AdtId, AstItemDef, ConstId, ContainerId, DefWithBodyId, EnumId, FunctionId, GenericParamId, | 18 | AdtId, AstItemDef, ConstId, ContainerId, DefWithBodyId, EnumId, FunctionId, HasModule, ImplId, |
19 | HasModule, ImplId, LocalEnumVariantId, LocalImportId, LocalModuleId, LocalStructFieldId, | 19 | LocalEnumVariantId, LocalImportId, LocalModuleId, LocalStructFieldId, Lookup, ModuleId, |
20 | Lookup, ModuleId, StaticId, StructId, TraitId, TypeAliasId, UnionId, | 20 | StaticId, StructId, TraitId, TypeAliasId, TypeParamId, UnionId, |
21 | }; | 21 | }; |
22 | use hir_expand::{ | 22 | use hir_expand::{ |
23 | diagnostics::DiagnosticSink, | 23 | diagnostics::DiagnosticSink, |
@@ -856,14 +856,14 @@ impl Local { | |||
856 | } | 856 | } |
857 | 857 | ||
858 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] | 858 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] |
859 | pub struct GenericParam { | 859 | pub struct TypeParam { |
860 | pub(crate) id: GenericParamId, | 860 | pub(crate) id: TypeParamId, |
861 | } | 861 | } |
862 | 862 | ||
863 | impl GenericParam { | 863 | impl TypeParam { |
864 | pub fn name(self, db: &impl HirDatabase) -> Name { | 864 | pub fn name(self, db: &impl HirDatabase) -> Name { |
865 | let params = db.generic_params(self.id.parent); | 865 | let params = db.generic_params(self.id.parent); |
866 | params.params[self.id.local_id].name.clone() | 866 | params.types[self.id.local_id].name.clone() |
867 | } | 867 | } |
868 | 868 | ||
869 | pub fn module(self, db: &impl HirDatabase) -> Module { | 869 | pub fn module(self, db: &impl HirDatabase) -> Module { |
@@ -1111,7 +1111,7 @@ impl HirDisplay for Type { | |||
1111 | pub enum ScopeDef { | 1111 | pub enum ScopeDef { |
1112 | ModuleDef(ModuleDef), | 1112 | ModuleDef(ModuleDef), |
1113 | MacroDef(MacroDef), | 1113 | MacroDef(MacroDef), |
1114 | GenericParam(GenericParam), | 1114 | GenericParam(TypeParam), |
1115 | ImplSelfType(ImplBlock), | 1115 | ImplSelfType(ImplBlock), |
1116 | AdtSelfType(Adt), | 1116 | AdtSelfType(Adt), |
1117 | Local(Local), | 1117 | Local(Local), |
diff --git a/crates/ra_hir/src/code_model/src.rs b/crates/ra_hir/src/code_model/src.rs index 8f04ebd23..b09582f93 100644 --- a/crates/ra_hir/src/code_model/src.rs +++ b/crates/ra_hir/src/code_model/src.rs | |||
@@ -9,8 +9,8 @@ use hir_def::{ | |||
9 | use ra_syntax::ast; | 9 | use ra_syntax::ast; |
10 | 10 | ||
11 | use crate::{ | 11 | use crate::{ |
12 | db::DefDatabase, Const, Enum, EnumVariant, FieldSource, Function, GenericParam, ImplBlock, | 12 | db::DefDatabase, Const, Enum, EnumVariant, FieldSource, Function, ImplBlock, Import, MacroDef, |
13 | Import, MacroDef, Module, Static, Struct, StructField, Trait, TypeAlias, Union, | 13 | Module, Static, Struct, StructField, Trait, TypeAlias, TypeParam, Union, |
14 | }; | 14 | }; |
15 | 15 | ||
16 | pub use hir_expand::InFile; | 16 | pub use hir_expand::InFile; |
@@ -130,7 +130,7 @@ impl HasSource for Import { | |||
130 | } | 130 | } |
131 | } | 131 | } |
132 | 132 | ||
133 | impl HasSource for GenericParam { | 133 | impl HasSource for TypeParam { |
134 | type Ast = Either<ast::TraitDef, ast::TypeParam>; | 134 | type Ast = Either<ast::TraitDef, ast::TypeParam>; |
135 | fn source(self, db: &impl DefDatabase) -> InFile<Self::Ast> { | 135 | fn source(self, db: &impl DefDatabase) -> InFile<Self::Ast> { |
136 | let child_source = self.id.parent.child_source(db); | 136 | let child_source = self.id.parent.child_source(db); |
diff --git a/crates/ra_hir/src/from_source.rs b/crates/ra_hir/src/from_source.rs index 686ab1d79..68e59fc1e 100644 --- a/crates/ra_hir/src/from_source.rs +++ b/crates/ra_hir/src/from_source.rs | |||
@@ -11,8 +11,8 @@ use ra_syntax::{ | |||
11 | 11 | ||
12 | use crate::{ | 12 | use crate::{ |
13 | db::{AstDatabase, DefDatabase, HirDatabase}, | 13 | db::{AstDatabase, DefDatabase, HirDatabase}, |
14 | Const, DefWithBody, Enum, EnumVariant, FieldSource, Function, GenericParam, ImplBlock, InFile, | 14 | Const, DefWithBody, Enum, EnumVariant, FieldSource, Function, ImplBlock, InFile, Local, |
15 | Local, MacroDef, Module, Static, Struct, StructField, Trait, TypeAlias, Union, | 15 | MacroDef, Module, Static, Struct, StructField, Trait, TypeAlias, TypeParam, Union, |
16 | }; | 16 | }; |
17 | 17 | ||
18 | pub trait FromSource: Sized { | 18 | pub trait FromSource: Sized { |
@@ -177,7 +177,7 @@ impl Local { | |||
177 | } | 177 | } |
178 | } | 178 | } |
179 | 179 | ||
180 | impl GenericParam { | 180 | impl TypeParam { |
181 | pub fn from_source(db: &impl HirDatabase, src: InFile<ast::TypeParam>) -> Option<Self> { | 181 | pub fn from_source(db: &impl HirDatabase, src: InFile<ast::TypeParam>) -> Option<Self> { |
182 | let file_id = src.file_id; | 182 | let file_id = src.file_id; |
183 | let parent: GenericDefId = src.value.syntax().ancestors().find_map(|it| { | 183 | let parent: GenericDefId = src.value.syntax().ancestors().find_map(|it| { |
@@ -190,7 +190,7 @@ impl GenericParam { | |||
190 | Some(res) | 190 | Some(res) |
191 | })?; | 191 | })?; |
192 | let &id = parent.child_by_source(db)[keys::TYPE_PARAM].get(&src)?; | 192 | let &id = parent.child_by_source(db)[keys::TYPE_PARAM].get(&src)?; |
193 | Some(GenericParam { id }) | 193 | Some(TypeParam { id }) |
194 | } | 194 | } |
195 | } | 195 | } |
196 | 196 | ||
diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs index f12e4ca3f..9eb34b5dc 100644 --- a/crates/ra_hir/src/lib.rs +++ b/crates/ra_hir/src/lib.rs | |||
@@ -42,9 +42,9 @@ pub mod from_source; | |||
42 | pub use crate::{ | 42 | pub use crate::{ |
43 | code_model::{ | 43 | code_model::{ |
44 | src::HasSource, Adt, AssocItem, AttrDef, Const, Container, Crate, CrateDependency, | 44 | src::HasSource, Adt, AssocItem, AttrDef, Const, Container, Crate, CrateDependency, |
45 | DefWithBody, Docs, Enum, EnumVariant, FieldSource, Function, GenericDef, GenericParam, | 45 | DefWithBody, Docs, Enum, EnumVariant, FieldSource, Function, GenericDef, HasAttrs, |
46 | HasAttrs, ImplBlock, Import, Local, MacroDef, Module, ModuleDef, ScopeDef, Static, Struct, | 46 | ImplBlock, Import, Local, MacroDef, Module, ModuleDef, ScopeDef, Static, Struct, |
47 | StructField, Trait, Type, TypeAlias, Union, VariantDef, | 47 | StructField, Trait, Type, TypeAlias, TypeParam, Union, VariantDef, |
48 | }, | 48 | }, |
49 | from_source::FromSource, | 49 | from_source::FromSource, |
50 | source_binder::{PathResolution, ScopeEntryWithSyntax, SourceAnalyzer}, | 50 | source_binder::{PathResolution, ScopeEntryWithSyntax, SourceAnalyzer}, |
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index 2957e496c..b80aaeb90 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs | |||
@@ -36,8 +36,8 @@ use crate::{ | |||
36 | method_resolution::{self, implements_trait}, | 36 | method_resolution::{self, implements_trait}, |
37 | InEnvironment, TraitEnvironment, Ty, | 37 | InEnvironment, TraitEnvironment, Ty, |
38 | }, | 38 | }, |
39 | Adt, AssocItem, Const, DefWithBody, Enum, EnumVariant, FromSource, Function, GenericParam, | 39 | Adt, AssocItem, Const, DefWithBody, Enum, EnumVariant, FromSource, Function, ImplBlock, Local, |
40 | ImplBlock, Local, MacroDef, Name, Path, ScopeDef, Static, Struct, Trait, Type, TypeAlias, | 40 | MacroDef, Name, Path, ScopeDef, Static, Struct, Trait, Type, TypeAlias, TypeParam, |
41 | }; | 41 | }; |
42 | 42 | ||
43 | fn try_get_resolver_for_node(db: &impl HirDatabase, node: InFile<&SyntaxNode>) -> Option<Resolver> { | 43 | fn try_get_resolver_for_node(db: &impl HirDatabase, node: InFile<&SyntaxNode>) -> Option<Resolver> { |
@@ -112,7 +112,7 @@ pub enum PathResolution { | |||
112 | /// A local binding (only value namespace) | 112 | /// A local binding (only value namespace) |
113 | Local(Local), | 113 | Local(Local), |
114 | /// A generic parameter | 114 | /// A generic parameter |
115 | GenericParam(GenericParam), | 115 | TypeParam(TypeParam), |
116 | SelfType(crate::ImplBlock), | 116 | SelfType(crate::ImplBlock), |
117 | Macro(MacroDef), | 117 | Macro(MacroDef), |
118 | AssocItem(crate::AssocItem), | 118 | AssocItem(crate::AssocItem), |
@@ -266,7 +266,7 @@ impl SourceAnalyzer { | |||
266 | ) -> Option<PathResolution> { | 266 | ) -> Option<PathResolution> { |
267 | let types = self.resolver.resolve_path_in_type_ns_fully(db, &path).map(|ty| match ty { | 267 | let types = self.resolver.resolve_path_in_type_ns_fully(db, &path).map(|ty| match ty { |
268 | TypeNs::SelfType(it) => PathResolution::SelfType(it.into()), | 268 | TypeNs::SelfType(it) => PathResolution::SelfType(it.into()), |
269 | TypeNs::GenericParam(id) => PathResolution::GenericParam(GenericParam { id }), | 269 | TypeNs::GenericParam(id) => PathResolution::TypeParam(TypeParam { id }), |
270 | TypeNs::AdtSelfType(it) | TypeNs::AdtId(it) => { | 270 | TypeNs::AdtSelfType(it) | TypeNs::AdtId(it) => { |
271 | PathResolution::Def(Adt::from(it).into()) | 271 | PathResolution::Def(Adt::from(it).into()) |
272 | } | 272 | } |
@@ -338,7 +338,7 @@ impl SourceAnalyzer { | |||
338 | resolver::ScopeDef::PerNs(it) => it.into(), | 338 | resolver::ScopeDef::PerNs(it) => it.into(), |
339 | resolver::ScopeDef::ImplSelfType(it) => ScopeDef::ImplSelfType(it.into()), | 339 | resolver::ScopeDef::ImplSelfType(it) => ScopeDef::ImplSelfType(it.into()), |
340 | resolver::ScopeDef::AdtSelfType(it) => ScopeDef::AdtSelfType(it.into()), | 340 | resolver::ScopeDef::AdtSelfType(it) => ScopeDef::AdtSelfType(it.into()), |
341 | resolver::ScopeDef::GenericParam(id) => ScopeDef::GenericParam(GenericParam { id }), | 341 | resolver::ScopeDef::GenericParam(id) => ScopeDef::GenericParam(TypeParam { id }), |
342 | resolver::ScopeDef::Local(pat_id) => { | 342 | resolver::ScopeDef::Local(pat_id) => { |
343 | let parent = self.resolver.body_owner().unwrap().into(); | 343 | let parent = self.resolver.body_owner().unwrap().into(); |
344 | ScopeDef::Local(Local { parent, pat_id }) | 344 | ScopeDef::Local(Local { parent, pat_id }) |