aboutsummaryrefslogtreecommitdiff
path: root/crates/hir
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir')
-rw-r--r--crates/hir/src/lib.rs19
-rw-r--r--crates/hir/src/semantics.rs3
2 files changed, 21 insertions, 1 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index c2b68a853..dba46df04 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -1351,6 +1351,13 @@ impl MacroDef {
1351 MacroDefKind::ProcMacro(_, base_db::ProcMacroKind::FuncLike, _) => MacroKind::ProcMacro, 1351 MacroDefKind::ProcMacro(_, base_db::ProcMacroKind::FuncLike, _) => MacroKind::ProcMacro,
1352 } 1352 }
1353 } 1353 }
1354
1355 pub fn is_fn_like(&self) -> bool {
1356 match self.kind() {
1357 MacroKind::Declarative | MacroKind::BuiltIn | MacroKind::ProcMacro => true,
1358 MacroKind::Attr | MacroKind::Derive => false,
1359 }
1360 }
1354} 1361}
1355 1362
1356/// Invariant: `inner.as_assoc_item(db).is_some()` 1363/// Invariant: `inner.as_assoc_item(db).is_some()`
@@ -2496,6 +2503,18 @@ impl ScopeDef {
2496 2503
2497 items 2504 items
2498 } 2505 }
2506
2507 pub fn is_value_def(&self) -> bool {
2508 matches!(
2509 self,
2510 ScopeDef::ModuleDef(ModuleDef::Function(_))
2511 | ScopeDef::ModuleDef(ModuleDef::Variant(_))
2512 | ScopeDef::ModuleDef(ModuleDef::Const(_))
2513 | ScopeDef::ModuleDef(ModuleDef::Static(_))
2514 | ScopeDef::GenericParam(GenericParam::ConstParam(_))
2515 | ScopeDef::Local(_)
2516 )
2517 }
2499} 2518}
2500 2519
2501impl From<ItemInNs> for ScopeDef { 2520impl 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),