From 35b3fc02e02fa21deb51105d04132d55d4282754 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 2 Jan 2019 16:00:01 +0300 Subject: comments --- crates/ra_hir/src/ids.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'crates/ra_hir/src/ids.rs') 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::{ pub struct HirFileId(HirFileIdRepr); impl HirFileId { + /// For macro-expansion files, returns the file original source file the + /// expansionoriginated from. pub(crate) fn original_file_id(self, db: &impl HirDatabase) -> FileId { match self.0 { HirFileIdRepr::File(file_id) => file_id, @@ -45,6 +47,7 @@ impl HirFileId { HirFileIdRepr::Macro(_r) => panic!("macro generated file: {:?}", self), } } + pub(crate) fn hir_source_file(db: &impl HirDatabase, file_id: HirFileId) -> SourceFileNode { match file_id.0 { HirFileIdRepr::File(file_id) => db.source_file(file_id), -- cgit v1.2.3