diff options
author | Jonas Schievink <[email protected]> | 2021-03-19 13:23:13 +0000 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2021-03-19 13:23:13 +0000 |
commit | 54c78c96dbe61c2f1b6ec9f83a35a8ad6f6ae4fe (patch) | |
tree | 960d42c02317050c6415b13fc74ad3c1f55f1c20 /crates | |
parent | a627377949d308603bb0bd7ef627ffe8186e1788 (diff) |
Rename derive-specific APIs
Diffstat (limited to 'crates')
-rw-r--r-- | crates/hir_def/src/lib.rs | 4 | ||||
-rw-r--r-- | crates/hir_def/src/nameres.rs | 4 | ||||
-rw-r--r-- | crates/hir_def/src/nameres/collector.rs | 8 | ||||
-rw-r--r-- | crates/hir_expand/src/builtin_derive.rs | 2 | ||||
-rw-r--r-- | crates/hir_expand/src/lib.rs | 8 |
5 files changed, 13 insertions, 13 deletions
diff --git a/crates/hir_def/src/lib.rs b/crates/hir_def/src/lib.rs index 50e730444..c9e07de86 100644 --- a/crates/hir_def/src/lib.rs +++ b/crates/hir_def/src/lib.rs | |||
@@ -673,7 +673,7 @@ fn macro_call_as_call_id( | |||
673 | Ok(res) | 673 | Ok(res) |
674 | } | 674 | } |
675 | 675 | ||
676 | fn item_attr_as_call_id( | 676 | fn derive_macro_as_call_id( |
677 | item_attr: &AstIdWithPath<ast::Item>, | 677 | item_attr: &AstIdWithPath<ast::Item>, |
678 | db: &dyn db::DefDatabase, | 678 | db: &dyn db::DefDatabase, |
679 | krate: CrateId, | 679 | krate: CrateId, |
@@ -685,7 +685,7 @@ fn item_attr_as_call_id( | |||
685 | .as_lazy_macro( | 685 | .as_lazy_macro( |
686 | db.upcast(), | 686 | db.upcast(), |
687 | krate, | 687 | krate, |
688 | MacroCallKind::Attr(item_attr.ast_id, last_segment.to_string()), | 688 | MacroCallKind::Derive(item_attr.ast_id, last_segment.to_string()), |
689 | ) | 689 | ) |
690 | .into(); | 690 | .into(); |
691 | Ok(res) | 691 | Ok(res) |
diff --git a/crates/hir_def/src/nameres.rs b/crates/hir_def/src/nameres.rs index 1ac326f97..0d3a0b54f 100644 --- a/crates/hir_def/src/nameres.rs +++ b/crates/hir_def/src/nameres.rs | |||
@@ -575,7 +575,7 @@ mod diagnostics { | |||
575 | let node = ast.to_node(db.upcast()); | 575 | let node = ast.to_node(db.upcast()); |
576 | (ast.file_id, SyntaxNodePtr::from(AstPtr::new(&node)), None) | 576 | (ast.file_id, SyntaxNodePtr::from(AstPtr::new(&node)), None) |
577 | } | 577 | } |
578 | MacroCallKind::Attr(ast, name) => { | 578 | MacroCallKind::Derive(ast, name) => { |
579 | let node = ast.to_node(db.upcast()); | 579 | let node = ast.to_node(db.upcast()); |
580 | 580 | ||
581 | // Compute the precise location of the macro name's token in the derive | 581 | // Compute the precise location of the macro name's token in the derive |
@@ -631,7 +631,7 @@ mod diagnostics { | |||
631 | let node = ast.to_node(db.upcast()); | 631 | let node = ast.to_node(db.upcast()); |
632 | (ast.file_id, SyntaxNodePtr::from(AstPtr::new(&node))) | 632 | (ast.file_id, SyntaxNodePtr::from(AstPtr::new(&node))) |
633 | } | 633 | } |
634 | MacroCallKind::Attr(ast, _) => { | 634 | MacroCallKind::Derive(ast, _) => { |
635 | let node = ast.to_node(db.upcast()); | 635 | let node = ast.to_node(db.upcast()); |
636 | (ast.file_id, SyntaxNodePtr::from(AstPtr::new(&node))) | 636 | (ast.file_id, SyntaxNodePtr::from(AstPtr::new(&node))) |
637 | } | 637 | } |
diff --git a/crates/hir_def/src/nameres/collector.rs b/crates/hir_def/src/nameres/collector.rs index dcedf7766..4bcdc0fc8 100644 --- a/crates/hir_def/src/nameres/collector.rs +++ b/crates/hir_def/src/nameres/collector.rs | |||
@@ -22,7 +22,7 @@ use syntax::ast; | |||
22 | use crate::{ | 22 | use crate::{ |
23 | attr::Attrs, | 23 | attr::Attrs, |
24 | db::DefDatabase, | 24 | db::DefDatabase, |
25 | item_attr_as_call_id, | 25 | derive_macro_as_call_id, |
26 | item_scope::{ImportType, PerNsGlobImports}, | 26 | item_scope::{ImportType, PerNsGlobImports}, |
27 | item_tree::{ | 27 | item_tree::{ |
28 | self, FileItemTreeId, ItemTree, ItemTreeId, MacroCall, MacroRules, Mod, ModItem, ModKind, | 28 | self, FileItemTreeId, ItemTree, ItemTreeId, MacroCall, MacroRules, Mod, ModItem, ModKind, |
@@ -820,8 +820,8 @@ impl DefCollector<'_> { | |||
820 | true | 820 | true |
821 | }); | 821 | }); |
822 | attribute_macros.retain(|directive| { | 822 | attribute_macros.retain(|directive| { |
823 | match item_attr_as_call_id(&directive.ast_id, self.db, self.def_map.krate, |path| { | 823 | match derive_macro_as_call_id(&directive.ast_id, self.db, self.def_map.krate, |path| { |
824 | self.resolve_attribute_macro(&directive, &path) | 824 | self.resolve_derive_macro(&directive, &path) |
825 | }) { | 825 | }) { |
826 | Ok(call_id) => { | 826 | Ok(call_id) => { |
827 | resolved.push((directive.module_id, call_id, 0)); | 827 | resolved.push((directive.module_id, call_id, 0)); |
@@ -844,7 +844,7 @@ impl DefCollector<'_> { | |||
844 | res | 844 | res |
845 | } | 845 | } |
846 | 846 | ||
847 | fn resolve_attribute_macro( | 847 | fn resolve_derive_macro( |
848 | &self, | 848 | &self, |
849 | directive: &DeriveDirective, | 849 | directive: &DeriveDirective, |
850 | path: &ModPath, | 850 | path: &ModPath, |
diff --git a/crates/hir_expand/src/builtin_derive.rs b/crates/hir_expand/src/builtin_derive.rs index 60fd2ebdd..6ece4b289 100644 --- a/crates/hir_expand/src/builtin_derive.rs +++ b/crates/hir_expand/src/builtin_derive.rs | |||
@@ -317,7 +317,7 @@ $0 | |||
317 | local_inner: false, | 317 | local_inner: false, |
318 | }, | 318 | }, |
319 | krate: CrateId(0), | 319 | krate: CrateId(0), |
320 | kind: MacroCallKind::Attr(attr_id, name.to_string()), | 320 | kind: MacroCallKind::Derive(attr_id, name.to_string()), |
321 | }; | 321 | }; |
322 | 322 | ||
323 | let id: MacroCallId = db.intern_macro(loc).into(); | 323 | let id: MacroCallId = db.intern_macro(loc).into(); |
diff --git a/crates/hir_expand/src/lib.rs b/crates/hir_expand/src/lib.rs index 0a379651f..c958b0865 100644 --- a/crates/hir_expand/src/lib.rs +++ b/crates/hir_expand/src/lib.rs | |||
@@ -271,21 +271,21 @@ pub struct MacroCallLoc { | |||
271 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 271 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
272 | pub enum MacroCallKind { | 272 | pub enum MacroCallKind { |
273 | FnLike(AstId<ast::MacroCall>), | 273 | FnLike(AstId<ast::MacroCall>), |
274 | Attr(AstId<ast::Item>, String), | 274 | Derive(AstId<ast::Item>, String), |
275 | } | 275 | } |
276 | 276 | ||
277 | impl MacroCallKind { | 277 | impl MacroCallKind { |
278 | fn file_id(&self) -> HirFileId { | 278 | fn file_id(&self) -> HirFileId { |
279 | match self { | 279 | match self { |
280 | MacroCallKind::FnLike(ast_id) => ast_id.file_id, | 280 | MacroCallKind::FnLike(ast_id) => ast_id.file_id, |
281 | MacroCallKind::Attr(ast_id, _) => ast_id.file_id, | 281 | MacroCallKind::Derive(ast_id, _) => ast_id.file_id, |
282 | } | 282 | } |
283 | } | 283 | } |
284 | 284 | ||
285 | fn node(&self, db: &dyn db::AstDatabase) -> InFile<SyntaxNode> { | 285 | fn node(&self, db: &dyn db::AstDatabase) -> InFile<SyntaxNode> { |
286 | match self { | 286 | match self { |
287 | MacroCallKind::FnLike(ast_id) => ast_id.with_value(ast_id.to_node(db).syntax().clone()), | 287 | MacroCallKind::FnLike(ast_id) => ast_id.with_value(ast_id.to_node(db).syntax().clone()), |
288 | MacroCallKind::Attr(ast_id, _) => { | 288 | MacroCallKind::Derive(ast_id, _) => { |
289 | ast_id.with_value(ast_id.to_node(db).syntax().clone()) | 289 | ast_id.with_value(ast_id.to_node(db).syntax().clone()) |
290 | } | 290 | } |
291 | } | 291 | } |
@@ -296,7 +296,7 @@ impl MacroCallKind { | |||
296 | MacroCallKind::FnLike(ast_id) => { | 296 | MacroCallKind::FnLike(ast_id) => { |
297 | Some(ast_id.to_node(db).token_tree()?.syntax().clone()) | 297 | Some(ast_id.to_node(db).token_tree()?.syntax().clone()) |
298 | } | 298 | } |
299 | MacroCallKind::Attr(ast_id, _) => Some(ast_id.to_node(db).syntax().clone()), | 299 | MacroCallKind::Derive(ast_id, _) => Some(ast_id.to_node(db).syntax().clone()), |
300 | } | 300 | } |
301 | } | 301 | } |
302 | } | 302 | } |