add DefId
This commit is contained in:
parent
8086107b6a
commit
c54b51fded
@ -7,6 +7,7 @@ use ra_syntax::{
|
||||
};
|
||||
|
||||
use crate::{
|
||||
loc2id::DefId,
|
||||
descriptors::module::ModuleId,
|
||||
syntax_ptr::LocalSyntaxPtr,
|
||||
};
|
||||
@ -45,7 +46,8 @@ struct ItemMap {
|
||||
|
||||
#[derive(Debug)]
|
||||
struct ModuleItems {
|
||||
items: FxHashMap<SmolStr, PerNs<ModuleItem>>,
|
||||
items: FxHashMap<SmolStr, PerNs<DefId>>,
|
||||
import_resolutions: FxHashMap<LocalSyntaxPtr, DefId>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
@ -197,3 +199,14 @@ impl ModuleItem {
|
||||
Some(res)
|
||||
}
|
||||
}
|
||||
|
||||
struct Resolver {
|
||||
input: FxHashMap<ModuleId, InputModuleItems>,
|
||||
result: ModuleItems,
|
||||
}
|
||||
|
||||
impl Resolver {
|
||||
fn resolve(&mut self){
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,9 @@ use std::{
|
||||
use rustc_hash::FxHashMap;
|
||||
|
||||
use crate::{
|
||||
descriptors::module::ModuleId,
|
||||
syntax_ptr::SyntaxPtr,
|
||||
input::SourceRootId,
|
||||
};
|
||||
|
||||
/// There are two principle ways to refer to things:
|
||||
@ -89,6 +91,21 @@ macro_rules! impl_numeric_id {
|
||||
pub(crate) struct FnId(u32);
|
||||
impl_numeric_id!(FnId);
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub(crate) struct DefId(u32);
|
||||
impl_numeric_id!(DefId);
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
|
||||
enum DefLoc {
|
||||
Module {
|
||||
id: ModuleId,
|
||||
source_root: SourceRootId,
|
||||
},
|
||||
Item {
|
||||
ptr: SyntaxPtr,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) trait IdDatabase: salsa::Database {
|
||||
fn id_maps(&self) -> &IdMaps;
|
||||
}
|
||||
@ -110,4 +127,5 @@ impl IdMaps {
|
||||
#[derive(Debug, Default)]
|
||||
struct IdMapsInner {
|
||||
fns: Mutex<Loc2IdMap<SyntaxPtr, FnId>>,
|
||||
defs: Mutex<Loc2IdMap<DefLoc, DefId>>,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user