aboutsummaryrefslogtreecommitdiff
path: root/crates/hir/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir/src')
-rw-r--r--crates/hir/src/semantics.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs
index 920e18208..2d08a7704 100644
--- a/crates/hir/src/semantics.rs
+++ b/crates/hir/src/semantics.rs
@@ -123,6 +123,10 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> {
123 self.imp.expand_attr_macro(item) 123 self.imp.expand_attr_macro(item)
124 } 124 }
125 125
126 pub fn is_attr_macro_call(&self, item: &ast::Item) -> bool {
127 self.imp.is_attr_macro_call(item)
128 }
129
126 pub fn speculative_expand( 130 pub fn speculative_expand(
127 &self, 131 &self,
128 actual_macro_call: &ast::MacroCall, 132 actual_macro_call: &ast::MacroCall,
@@ -348,6 +352,12 @@ impl<'db> SemanticsImpl<'db> {
348 Some(node) 352 Some(node)
349 } 353 }
350 354
355 fn is_attr_macro_call(&self, item: &ast::Item) -> bool {
356 let sa = self.analyze(item.syntax());
357 let src = InFile::new(sa.file_id, item.clone());
358 self.with_ctx(|ctx| ctx.item_to_macro_call(src).is_some())
359 }
360
351 fn speculative_expand( 361 fn speculative_expand(
352 &self, 362 &self,
353 actual_macro_call: &ast::MacroCall, 363 actual_macro_call: &ast::MacroCall,