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