aboutsummaryrefslogtreecommitdiff
path: root/crates/hir/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir/src/lib.rs')
-rw-r--r--crates/hir/src/lib.rs19
1 files changed, 19 insertions, 0 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 {