From ae49a22b5cdd47add478fef6bb8ad3d75338e313 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Mon, 18 Nov 2019 03:35:46 +0800 Subject: Rebase --- crates/ra_hir/src/source_binder.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'crates/ra_hir/src') diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index f0ed8e2b2..6d75296a5 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs @@ -140,6 +140,11 @@ impl Expansion { exp_info.map_token_down(token) } + pub fn source(&self, db: &impl HirDatabase) -> Source> { + let loc = db.lookup_intern_macro(self.macro_call_id); + Source::new(self.file_id(), loc.ast_id) + } + fn file_id(&self) -> HirFileId { self.macro_call_id.as_file(MacroFileKind::Items) } -- cgit v1.2.3 From 94c63d280246971983cad4fa6ce2d333e3ba9f02 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Tue, 19 Nov 2019 22:56:28 +0800 Subject: Change to use Expansion::file_id and reordering --- crates/ra_hir/src/source_binder.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'crates/ra_hir/src') diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index 6d75296a5..5d3196c2a 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs @@ -140,12 +140,7 @@ impl Expansion { exp_info.map_token_down(token) } - pub fn source(&self, db: &impl HirDatabase) -> Source> { - let loc = db.lookup_intern_macro(self.macro_call_id); - Source::new(self.file_id(), loc.ast_id) - } - - fn file_id(&self) -> HirFileId { + pub fn file_id(&self) -> HirFileId { self.macro_call_id.as_file(MacroFileKind::Items) } } -- cgit v1.2.3