diff options
author | Aleksey Kladov <[email protected]> | 2019-01-02 13:00:01 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-02 13:00:01 +0000 |
commit | 35b3fc02e02fa21deb51105d04132d55d4282754 (patch) | |
tree | f4ef767d1c24203047693ee771b12ab0354c892f /crates/ra_hir/src/ids.rs | |
parent | 4fe0ec5497cdbd7910b0197d254c2b2356fe1874 (diff) |
comments
Diffstat (limited to 'crates/ra_hir/src/ids.rs')
-rw-r--r-- | crates/ra_hir/src/ids.rs | 3 |
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::{ | |||
29 | pub struct HirFileId(HirFileIdRepr); | 29 | pub struct HirFileId(HirFileIdRepr); |
30 | 30 | ||
31 | impl HirFileId { | 31 | impl 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), |