mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 02:03:53 +00:00
rename
This commit is contained in:
parent
b2fec18098
commit
882a86240f
@ -15,7 +15,7 @@ pub(crate) struct RootDatabase {
|
||||
#[derive(Default)]
|
||||
struct IdMaps {
|
||||
defs: LocationIntener<hir::DefLoc, hir::DefId>,
|
||||
macros: LocationIntener<hir::MacroInvocationLoc, hir::MacroInvocationId>,
|
||||
macros: LocationIntener<hir::MacroCallLoc, hir::MacroCallId>,
|
||||
}
|
||||
|
||||
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 {
|
||||
fn as_ref(&self) -> &LocationIntener<hir::MacroInvocationLoc, hir::MacroInvocationId> {
|
||||
impl AsRef<LocationIntener<hir::MacroCallLoc, hir::MacroCallId>> for RootDatabase {
|
||||
fn as_ref(&self) -> &LocationIntener<hir::MacroCallLoc, hir::MacroCallId> {
|
||||
&self.id_maps.macros
|
||||
}
|
||||
}
|
||||
@ -91,7 +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 expand_macro_invocation() for hir::db::ExpandMacroCallQuery;
|
||||
fn module_tree() for hir::db::ModuleTreeQuery;
|
||||
fn fn_scopes() for hir::db::FnScopesQuery;
|
||||
fn file_items() for hir::db::SourceFileItemsQuery;
|
||||
|
@ -8,7 +8,7 @@ use crate::{
|
||||
SourceFileItems, SourceItemId,
|
||||
query_definitions,
|
||||
FnScopes,
|
||||
macros::{MacroInvocationLoc, MacroInvocationId, MacroInput, MacroDef, MacroExpansion},
|
||||
macros::{MacroCallLoc, MacroCallId, MacroInput, MacroDef, MacroExpansion},
|
||||
module::{ModuleId, ModuleTree, ModuleSource,
|
||||
nameres::{ItemMap, InputModuleItems}},
|
||||
ty::{InferenceResult, Ty},
|
||||
@ -19,10 +19,10 @@ salsa::query_group! {
|
||||
|
||||
pub trait HirDatabase: SyntaxDatabase
|
||||
+ AsRef<LocationIntener<DefLoc, DefId>>
|
||||
+ AsRef<LocationIntener<MacroInvocationLoc, MacroInvocationId>>
|
||||
+ AsRef<LocationIntener<MacroCallLoc, MacroCallId>>
|
||||
{
|
||||
fn expand_macro_invocation(invoc: MacroInvocationId) -> Option<Arc<MacroExpansion>> {
|
||||
type ExpandMacroInvocationQuery;
|
||||
fn expand_macro_invocation(invoc: MacroCallId) -> Option<Arc<MacroExpansion>> {
|
||||
type ExpandMacroCallQuery;
|
||||
use fn crate::macros::expand_macro_invocation;
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ pub use self::{
|
||||
path::{Path, PathKind},
|
||||
name::Name,
|
||||
krate::Crate,
|
||||
macros::{MacroDef, MacroInput, MacroExpansion, MacroInvocationId, MacroInvocationLoc},
|
||||
macros::{MacroDef, MacroInput, MacroExpansion, MacroCallId, MacroCallLoc},
|
||||
module::{Module, ModuleId, Problem, nameres::{ItemMap, PerNs, Namespace}, ModuleScope, Resolution},
|
||||
function::{Function, FnScopes},
|
||||
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)
|
||||
/// in a specific module.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub struct MacroInvocationId(u32);
|
||||
ra_db::impl_numeric_id!(MacroInvocationId);
|
||||
pub struct MacroCallId(u32);
|
||||
ra_db::impl_numeric_id!(MacroCallId);
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub struct MacroInvocationLoc {
|
||||
pub struct MacroCallLoc {
|
||||
source_root_id: SourceRootId,
|
||||
module_id: ModuleId,
|
||||
source_item_id: SourceItemId,
|
||||
}
|
||||
|
||||
impl MacroInvocationId {
|
||||
impl MacroCallId {
|
||||
pub(crate) fn loc(
|
||||
self,
|
||||
db: &impl AsRef<LocationIntener<MacroInvocationLoc, MacroInvocationId>>,
|
||||
) -> MacroInvocationLoc {
|
||||
db: &impl AsRef<LocationIntener<MacroCallLoc, MacroCallId>>,
|
||||
) -> MacroCallLoc {
|
||||
db.as_ref().id2loc(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl MacroInvocationLoc {
|
||||
impl MacroCallLoc {
|
||||
#[allow(unused)]
|
||||
pub(crate) fn id(
|
||||
&self,
|
||||
db: &impl AsRef<LocationIntener<MacroInvocationLoc, MacroInvocationId>>,
|
||||
) -> MacroInvocationId {
|
||||
db: &impl AsRef<LocationIntener<MacroCallLoc, MacroCallId>>,
|
||||
) -> MacroCallId {
|
||||
db.as_ref().loc2id(&self)
|
||||
}
|
||||
}
|
||||
@ -150,7 +150,7 @@ impl MacroExpansion {
|
||||
|
||||
pub(crate) fn expand_macro_invocation(
|
||||
db: &impl HirDatabase,
|
||||
invoc: MacroInvocationId,
|
||||
invoc: MacroCallId,
|
||||
) -> Option<Arc<MacroExpansion>> {
|
||||
let loc = invoc.loc(db);
|
||||
let syntax = db.file_item(loc.source_item_id);
|
||||
|
Loading…
Reference in New Issue
Block a user