Rename derive-specific APIs

This commit is contained in:
Jonas Schievink 2021-03-19 14:23:13 +01:00
parent a627377949
commit 54c78c96db
5 changed files with 13 additions and 13 deletions

View file

@ -271,21 +271,21 @@ pub struct MacroCallLoc {
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum MacroCallKind {
FnLike(AstId<ast::MacroCall>),
Attr(AstId<ast::Item>, String),
Derive(AstId<ast::Item>, String),
}
impl MacroCallKind {
fn file_id(&self) -> HirFileId {
match self {
MacroCallKind::FnLike(ast_id) => ast_id.file_id,
MacroCallKind::Attr(ast_id, _) => ast_id.file_id,
MacroCallKind::Derive(ast_id, _) => ast_id.file_id,
}
}
fn node(&self, db: &dyn db::AstDatabase) -> InFile<SyntaxNode> {
match self {
MacroCallKind::FnLike(ast_id) => ast_id.with_value(ast_id.to_node(db).syntax().clone()),
MacroCallKind::Attr(ast_id, _) => {
MacroCallKind::Derive(ast_id, _) => {
ast_id.with_value(ast_id.to_node(db).syntax().clone())
}
}
@ -296,7 +296,7 @@ impl MacroCallKind {
MacroCallKind::FnLike(ast_id) => {
Some(ast_id.to_node(db).token_tree()?.syntax().clone())
}
MacroCallKind::Attr(ast_id, _) => Some(ast_id.to_node(db).syntax().clone()),
MacroCallKind::Derive(ast_id, _) => Some(ast_id.to_node(db).syntax().clone()),
}
}
}