allow expanding expressions

This commit is contained in:
Aleksey Kladov 2019-05-14 01:52:31 +03:00
parent 16c7405262
commit caa8663c08
2 changed files with 8 additions and 7 deletions

View file

@ -81,6 +81,9 @@ impl HirFileId {
MacroFileKind::Items => {
Some(mbe::token_tree_to_ast_item_list(&tt).syntax().to_owned())
}
MacroFileKind::Expr => {
mbe::token_tree_to_expr(&tt).ok().map(|it| it.syntax().to_owned())
}
}
}
}
@ -102,6 +105,7 @@ struct MacroFile {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub(crate) enum MacroFileKind {
Items,
Expr,
}
impl From<FileId> for HirFileId {