Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-expand/src/lib.rs')
-rw-r--r--crates/hir-expand/src/lib.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/crates/hir-expand/src/lib.rs b/crates/hir-expand/src/lib.rs
index bd216ccca8..b7d59791b2 100644
--- a/crates/hir-expand/src/lib.rs
+++ b/crates/hir-expand/src/lib.rs
@@ -520,6 +520,24 @@ impl MacroCallLoc {
}
}
}
+
+ pub fn include_file_id(
+ &self,
+ db: &dyn ExpandDatabase,
+ macro_call_id: MacroCallId,
+ ) -> Option<FileId> {
+ if self.def.is_include() {
+ if let Some(eager) = &self.eager {
+ if let Ok(it) =
+ builtin_fn_macro::include_input_to_file_id(db, macro_call_id, &eager.arg)
+ {
+ return Some(it);
+ }
+ }
+ }
+
+ None
+ }
}
impl MacroCallKind {