mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Rename derive-specific APIs
This commit is contained in:
parent
a627377949
commit
54c78c96db
5 changed files with 13 additions and 13 deletions
|
@ -317,7 +317,7 @@ $0
|
|||
local_inner: false,
|
||||
},
|
||||
krate: CrateId(0),
|
||||
kind: MacroCallKind::Attr(attr_id, name.to_string()),
|
||||
kind: MacroCallKind::Derive(attr_id, name.to_string()),
|
||||
};
|
||||
|
||||
let id: MacroCallId = db.intern_macro(loc).into();
|
||||
|
|
|
@ -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()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue