This commit is contained in:
Edwin Cheng
2019-11-18 03:35:46 +08:00
parent 3ccd05fedc
commit ae49a22b5c
2 changed files with 9 additions and 3 deletions

View File

@@ -140,6 +140,11 @@ impl Expansion {
exp_info.map_token_down(token)
}
pub fn source(&self, db: &impl HirDatabase) -> Source<AstId<ast::MacroCall>> {
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)
}