mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
move more macros to hir
This commit is contained in:
parent
57030f587b
commit
b2fec18098
8 changed files with 127 additions and 85 deletions
|
@ -1,7 +1,6 @@
|
|||
use std::{fmt, sync::Arc};
|
||||
use salsa::{self, Database};
|
||||
use ra_db::{LocationIntener, BaseDatabase};
|
||||
use hir::{self, DefId, DefLoc};
|
||||
|
||||
use crate::{
|
||||
symbol_index,
|
||||
|
@ -15,7 +14,8 @@ pub(crate) struct RootDatabase {
|
|||
|
||||
#[derive(Default)]
|
||||
struct IdMaps {
|
||||
defs: LocationIntener<DefLoc, DefId>,
|
||||
defs: LocationIntener<hir::DefLoc, hir::DefId>,
|
||||
macros: LocationIntener<hir::MacroInvocationLoc, hir::MacroInvocationId>,
|
||||
}
|
||||
|
||||
impl fmt::Debug for IdMaps {
|
||||
|
@ -59,12 +59,18 @@ impl salsa::ParallelDatabase for RootDatabase {
|
|||
|
||||
impl BaseDatabase for RootDatabase {}
|
||||
|
||||
impl AsRef<LocationIntener<DefLoc, DefId>> for RootDatabase {
|
||||
fn as_ref(&self) -> &LocationIntener<DefLoc, DefId> {
|
||||
impl AsRef<LocationIntener<hir::DefLoc, hir::DefId>> for RootDatabase {
|
||||
fn as_ref(&self) -> &LocationIntener<hir::DefLoc, hir::DefId> {
|
||||
&self.id_maps.defs
|
||||
}
|
||||
}
|
||||
|
||||
impl AsRef<LocationIntener<hir::MacroInvocationLoc, hir::MacroInvocationId>> for RootDatabase {
|
||||
fn as_ref(&self) -> &LocationIntener<hir::MacroInvocationLoc, hir::MacroInvocationId> {
|
||||
&self.id_maps.macros
|
||||
}
|
||||
}
|
||||
|
||||
salsa::database_storage! {
|
||||
pub(crate) struct RootDatabaseStorage for RootDatabase {
|
||||
impl ra_db::FilesDatabase {
|
||||
|
@ -85,6 +91,7 @@ salsa::database_storage! {
|
|||
fn library_symbols() for symbol_index::LibrarySymbolsQuery;
|
||||
}
|
||||
impl hir::db::HirDatabase {
|
||||
fn expand_macro_invocation() for hir::db::ExpandMacroInvocationQuery;
|
||||
fn module_tree() for hir::db::ModuleTreeQuery;
|
||||
fn fn_scopes() for hir::db::FnScopesQuery;
|
||||
fn file_items() for hir::db::SourceFileItemsQuery;
|
||||
|
@ -98,8 +105,5 @@ salsa::database_storage! {
|
|||
fn struct_data() for hir::db::StructDataQuery;
|
||||
fn enum_data() for hir::db::EnumDataQuery;
|
||||
}
|
||||
impl hir::MacroDatabase {
|
||||
fn expand_macro() for hir::ExpandMacroQuery;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue