use Source for MacroDef

This commit is contained in:
Aleksey Kladov 2019-06-11 17:40:18 +03:00
parent a6e339e822
commit 8b94b429e5
4 changed files with 18 additions and 13 deletions

View file

@ -1003,12 +1003,17 @@ pub struct MacroDef {
pub(crate) id: MacroDefId,
}
impl HasSource for MacroDef {
type Ast = TreeArc<ast::MacroCall>;
fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source<TreeArc<ast::MacroCall>> {
(self.id.0.file_id(), self.id.0.to_node(db)).into()
}
}
impl MacroDef {
pub fn source(
&self,
db: &(impl DefDatabase + AstDatabase),
) -> (HirFileId, TreeArc<ast::MacroCall>) {
(self.id.0.file_id(), self.id.0.to_node(db))
pub fn source(&self, db: &(impl DefDatabase + AstDatabase)) -> Source<TreeArc<ast::MacroCall>> {
(self.id.0.file_id(), self.id.0.to_node(db)).into()
}
}