mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Make MacroDefId's AstId
mandatory when possible
This commit is contained in:
parent
816bc73895
commit
b84efbaacf
13 changed files with 58 additions and 55 deletions
|
@ -195,12 +195,12 @@ impl SourceToDefCtx<'_, '_> {
|
|||
&mut self,
|
||||
src: InFile<ast::MacroRules>,
|
||||
) -> Option<MacroDefId> {
|
||||
let kind = MacroDefKind::Declarative;
|
||||
let file_ast_id = self.db.ast_id_map(src.file_id).ast_id(&src.value);
|
||||
let ast_id = AstId::new(src.file_id, file_ast_id.upcast());
|
||||
let kind = MacroDefKind::Declarative(ast_id);
|
||||
let file_id = src.file_id.original_file(self.db.upcast());
|
||||
let krate = self.file_to_def(file_id).get(0).copied()?.krate();
|
||||
let file_ast_id = self.db.ast_id_map(src.file_id).ast_id(&src.value);
|
||||
let ast_id = Some(AstId::new(src.file_id, file_ast_id.upcast()));
|
||||
Some(MacroDefId { krate, ast_id, kind, local_inner: false })
|
||||
Some(MacroDefId { krate, kind, local_inner: false })
|
||||
}
|
||||
|
||||
pub(super) fn find_container(&mut self, src: InFile<&SyntaxNode>) -> Option<ChildContainer> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue