aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ids.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/ids.rs')
-rw-r--r--crates/ra_hir/src/ids.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ids.rs b/crates/ra_hir/src/ids.rs
index 3504317ed..6d59ef659 100644
--- a/crates/ra_hir/src/ids.rs
+++ b/crates/ra_hir/src/ids.rs
@@ -29,6 +29,8 @@ use crate::{
29pub struct HirFileId(HirFileIdRepr); 29pub struct HirFileId(HirFileIdRepr);
30 30
31impl HirFileId { 31impl HirFileId {
32 /// For macro-expansion files, returns the file original source file the
33 /// expansionoriginated from.
32 pub(crate) fn original_file_id(self, db: &impl HirDatabase) -> FileId { 34 pub(crate) fn original_file_id(self, db: &impl HirDatabase) -> FileId {
33 match self.0 { 35 match self.0 {
34 HirFileIdRepr::File(file_id) => file_id, 36 HirFileIdRepr::File(file_id) => file_id,
@@ -45,6 +47,7 @@ impl HirFileId {
45 HirFileIdRepr::Macro(_r) => panic!("macro generated file: {:?}", self), 47 HirFileIdRepr::Macro(_r) => panic!("macro generated file: {:?}", self),
46 } 48 }
47 } 49 }
50
48 pub(crate) fn hir_source_file(db: &impl HirDatabase, file_id: HirFileId) -> SourceFileNode { 51 pub(crate) fn hir_source_file(db: &impl HirDatabase, file_id: HirFileId) -> SourceFileNode {
49 match file_id.0 { 52 match file_id.0 {
50 HirFileIdRepr::File(file_id) => db.source_file(file_id), 53 HirFileIdRepr::File(file_id) => db.source_file(file_id),