mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 22:31:43 +00:00
rename
This commit is contained in:
parent
b2fec18098
commit
882a86240f
4 changed files with 19 additions and 19 deletions
|
@ -15,7 +15,7 @@ pub(crate) struct RootDatabase {
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct IdMaps {
|
struct IdMaps {
|
||||||
defs: LocationIntener<hir::DefLoc, hir::DefId>,
|
defs: LocationIntener<hir::DefLoc, hir::DefId>,
|
||||||
macros: LocationIntener<hir::MacroInvocationLoc, hir::MacroInvocationId>,
|
macros: LocationIntener<hir::MacroCallLoc, hir::MacroCallId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Debug for IdMaps {
|
impl fmt::Debug for IdMaps {
|
||||||
|
@ -65,8 +65,8 @@ impl AsRef<LocationIntener<hir::DefLoc, hir::DefId>> for RootDatabase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AsRef<LocationIntener<hir::MacroInvocationLoc, hir::MacroInvocationId>> for RootDatabase {
|
impl AsRef<LocationIntener<hir::MacroCallLoc, hir::MacroCallId>> for RootDatabase {
|
||||||
fn as_ref(&self) -> &LocationIntener<hir::MacroInvocationLoc, hir::MacroInvocationId> {
|
fn as_ref(&self) -> &LocationIntener<hir::MacroCallLoc, hir::MacroCallId> {
|
||||||
&self.id_maps.macros
|
&self.id_maps.macros
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ salsa::database_storage! {
|
||||||
fn library_symbols() for symbol_index::LibrarySymbolsQuery;
|
fn library_symbols() for symbol_index::LibrarySymbolsQuery;
|
||||||
}
|
}
|
||||||
impl hir::db::HirDatabase {
|
impl hir::db::HirDatabase {
|
||||||
fn expand_macro_invocation() for hir::db::ExpandMacroInvocationQuery;
|
fn expand_macro_invocation() for hir::db::ExpandMacroCallQuery;
|
||||||
fn module_tree() for hir::db::ModuleTreeQuery;
|
fn module_tree() for hir::db::ModuleTreeQuery;
|
||||||
fn fn_scopes() for hir::db::FnScopesQuery;
|
fn fn_scopes() for hir::db::FnScopesQuery;
|
||||||
fn file_items() for hir::db::SourceFileItemsQuery;
|
fn file_items() for hir::db::SourceFileItemsQuery;
|
||||||
|
|
|
@ -8,7 +8,7 @@ use crate::{
|
||||||
SourceFileItems, SourceItemId,
|
SourceFileItems, SourceItemId,
|
||||||
query_definitions,
|
query_definitions,
|
||||||
FnScopes,
|
FnScopes,
|
||||||
macros::{MacroInvocationLoc, MacroInvocationId, MacroInput, MacroDef, MacroExpansion},
|
macros::{MacroCallLoc, MacroCallId, MacroInput, MacroDef, MacroExpansion},
|
||||||
module::{ModuleId, ModuleTree, ModuleSource,
|
module::{ModuleId, ModuleTree, ModuleSource,
|
||||||
nameres::{ItemMap, InputModuleItems}},
|
nameres::{ItemMap, InputModuleItems}},
|
||||||
ty::{InferenceResult, Ty},
|
ty::{InferenceResult, Ty},
|
||||||
|
@ -19,10 +19,10 @@ salsa::query_group! {
|
||||||
|
|
||||||
pub trait HirDatabase: SyntaxDatabase
|
pub trait HirDatabase: SyntaxDatabase
|
||||||
+ AsRef<LocationIntener<DefLoc, DefId>>
|
+ AsRef<LocationIntener<DefLoc, DefId>>
|
||||||
+ AsRef<LocationIntener<MacroInvocationLoc, MacroInvocationId>>
|
+ AsRef<LocationIntener<MacroCallLoc, MacroCallId>>
|
||||||
{
|
{
|
||||||
fn expand_macro_invocation(invoc: MacroInvocationId) -> Option<Arc<MacroExpansion>> {
|
fn expand_macro_invocation(invoc: MacroCallId) -> Option<Arc<MacroExpansion>> {
|
||||||
type ExpandMacroInvocationQuery;
|
type ExpandMacroCallQuery;
|
||||||
use fn crate::macros::expand_macro_invocation;
|
use fn crate::macros::expand_macro_invocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ pub use self::{
|
||||||
path::{Path, PathKind},
|
path::{Path, PathKind},
|
||||||
name::Name,
|
name::Name,
|
||||||
krate::Crate,
|
krate::Crate,
|
||||||
macros::{MacroDef, MacroInput, MacroExpansion, MacroInvocationId, MacroInvocationLoc},
|
macros::{MacroDef, MacroInput, MacroExpansion, MacroCallId, MacroCallLoc},
|
||||||
module::{Module, ModuleId, Problem, nameres::{ItemMap, PerNs, Namespace}, ModuleScope, Resolution},
|
module::{Module, ModuleId, Problem, nameres::{ItemMap, PerNs, Namespace}, ModuleScope, Resolution},
|
||||||
function::{Function, FnScopes},
|
function::{Function, FnScopes},
|
||||||
adt::{Struct, Enum},
|
adt::{Struct, Enum},
|
||||||
|
|
|
@ -11,31 +11,31 @@ use crate::{SourceRootId, module::ModuleId, SourceItemId, HirDatabase};
|
||||||
/// Def's are a core concept of hir. A `Def` is an Item (function, module, etc)
|
/// Def's are a core concept of hir. A `Def` is an Item (function, module, etc)
|
||||||
/// in a specific module.
|
/// in a specific module.
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
pub struct MacroInvocationId(u32);
|
pub struct MacroCallId(u32);
|
||||||
ra_db::impl_numeric_id!(MacroInvocationId);
|
ra_db::impl_numeric_id!(MacroCallId);
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
pub struct MacroInvocationLoc {
|
pub struct MacroCallLoc {
|
||||||
source_root_id: SourceRootId,
|
source_root_id: SourceRootId,
|
||||||
module_id: ModuleId,
|
module_id: ModuleId,
|
||||||
source_item_id: SourceItemId,
|
source_item_id: SourceItemId,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MacroInvocationId {
|
impl MacroCallId {
|
||||||
pub(crate) fn loc(
|
pub(crate) fn loc(
|
||||||
self,
|
self,
|
||||||
db: &impl AsRef<LocationIntener<MacroInvocationLoc, MacroInvocationId>>,
|
db: &impl AsRef<LocationIntener<MacroCallLoc, MacroCallId>>,
|
||||||
) -> MacroInvocationLoc {
|
) -> MacroCallLoc {
|
||||||
db.as_ref().id2loc(self)
|
db.as_ref().id2loc(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MacroInvocationLoc {
|
impl MacroCallLoc {
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
pub(crate) fn id(
|
pub(crate) fn id(
|
||||||
&self,
|
&self,
|
||||||
db: &impl AsRef<LocationIntener<MacroInvocationLoc, MacroInvocationId>>,
|
db: &impl AsRef<LocationIntener<MacroCallLoc, MacroCallId>>,
|
||||||
) -> MacroInvocationId {
|
) -> MacroCallId {
|
||||||
db.as_ref().loc2id(&self)
|
db.as_ref().loc2id(&self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ impl MacroExpansion {
|
||||||
|
|
||||||
pub(crate) fn expand_macro_invocation(
|
pub(crate) fn expand_macro_invocation(
|
||||||
db: &impl HirDatabase,
|
db: &impl HirDatabase,
|
||||||
invoc: MacroInvocationId,
|
invoc: MacroCallId,
|
||||||
) -> Option<Arc<MacroExpansion>> {
|
) -> Option<Arc<MacroExpansion>> {
|
||||||
let loc = invoc.loc(db);
|
let loc = invoc.loc(db);
|
||||||
let syntax = db.file_item(loc.source_item_id);
|
let syntax = db.file_item(loc.source_item_id);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue