diff options
Diffstat (limited to 'crates/hir/src')
-rw-r--r-- | crates/hir/src/lib.rs | 12 | ||||
-rw-r--r-- | crates/hir/src/semantics.rs | 3 |
2 files changed, 14 insertions, 1 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index c2b68a853..589641760 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs | |||
@@ -2496,6 +2496,18 @@ impl ScopeDef { | |||
2496 | 2496 | ||
2497 | items | 2497 | items |
2498 | } | 2498 | } |
2499 | |||
2500 | pub fn is_value_def(&self) -> bool { | ||
2501 | matches!( | ||
2502 | self, | ||
2503 | ScopeDef::ModuleDef(ModuleDef::Function(_)) | ||
2504 | | ScopeDef::ModuleDef(ModuleDef::Variant(_)) | ||
2505 | | ScopeDef::ModuleDef(ModuleDef::Const(_)) | ||
2506 | | ScopeDef::ModuleDef(ModuleDef::Static(_)) | ||
2507 | | ScopeDef::GenericParam(GenericParam::ConstParam(_)) | ||
2508 | | ScopeDef::Local(_) | ||
2509 | ) | ||
2510 | } | ||
2499 | } | 2511 | } |
2500 | 2512 | ||
2501 | impl From<ItemInNs> for ScopeDef { | 2513 | impl From<ItemInNs> for ScopeDef { |
diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs index 2d08a7704..827e23e2b 100644 --- a/crates/hir/src/semantics.rs +++ b/crates/hir/src/semantics.rs | |||
@@ -35,8 +35,9 @@ pub enum PathResolution { | |||
35 | Def(ModuleDef), | 35 | Def(ModuleDef), |
36 | /// A local binding (only value namespace) | 36 | /// A local binding (only value namespace) |
37 | Local(Local), | 37 | Local(Local), |
38 | /// A generic parameter | 38 | /// A type parameter |
39 | TypeParam(TypeParam), | 39 | TypeParam(TypeParam), |
40 | /// A const parameter | ||
40 | ConstParam(ConstParam), | 41 | ConstParam(ConstParam), |
41 | SelfType(Impl), | 42 | SelfType(Impl), |
42 | Macro(MacroDef), | 43 | Macro(MacroDef), |