Privatize LocalImportID

This commit is contained in:
Aleksey Kladov 2019-12-21 12:47:34 +01:00
parent d335311893
commit 2d3fdf3fb5
3 changed files with 8 additions and 11 deletions

View file

@ -51,10 +51,6 @@ use ra_syntax::{ast, AstNode};
use crate::body::Expander; use crate::body::Expander;
use crate::builtin_type::BuiltinType; use crate::builtin_type::BuiltinType;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct LocalImportId(RawId);
impl_arena_id!(LocalImportId);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct ModuleId { pub struct ModuleId {
pub krate: CrateId, pub krate: CrateId,

View file

@ -26,8 +26,7 @@ use crate::{
path::{ModPath, PathKind}, path::{ModPath, PathKind},
per_ns::PerNs, per_ns::PerNs,
AdtId, AstId, ConstLoc, ContainerId, EnumLoc, EnumVariantId, FunctionLoc, ImplLoc, Intern, AdtId, AstId, ConstLoc, ContainerId, EnumLoc, EnumVariantId, FunctionLoc, ImplLoc, Intern,
LocalImportId, LocalModuleId, ModuleDefId, ModuleId, StaticLoc, StructLoc, TraitLoc, LocalModuleId, ModuleDefId, ModuleId, StaticLoc, StructLoc, TraitLoc, TypeAliasLoc, UnionLoc,
TypeAliasLoc, UnionLoc,
}; };
pub(super) fn collect_defs(db: &impl DefDatabase, mut def_map: CrateDefMap) -> CrateDefMap { pub(super) fn collect_defs(db: &impl DefDatabase, mut def_map: CrateDefMap) -> CrateDefMap {
@ -93,7 +92,7 @@ impl PartialResolvedImport {
#[derive(Clone, Debug, Eq, PartialEq)] #[derive(Clone, Debug, Eq, PartialEq)]
struct ImportDirective { struct ImportDirective {
module_id: LocalModuleId, module_id: LocalModuleId,
import_id: LocalImportId, import_id: raw::LocalImportId,
import: raw::ImportData, import: raw::ImportData,
status: PartialResolvedImport, status: PartialResolvedImport,
} }
@ -110,7 +109,7 @@ struct MacroDirective {
struct DefCollector<'a, DB> { struct DefCollector<'a, DB> {
db: &'a DB, db: &'a DB,
def_map: CrateDefMap, def_map: CrateDefMap,
glob_imports: FxHashMap<LocalModuleId, Vec<(LocalModuleId, LocalImportId)>>, glob_imports: FxHashMap<LocalModuleId, Vec<(LocalModuleId, raw::LocalImportId)>>,
unresolved_imports: Vec<ImportDirective>, unresolved_imports: Vec<ImportDirective>,
resolved_imports: Vec<ImportDirective>, resolved_imports: Vec<ImportDirective>,
unexpanded_macros: Vec<MacroDirective>, unexpanded_macros: Vec<MacroDirective>,

View file

@ -20,9 +20,11 @@ use ra_syntax::{
}; };
use test_utils::tested_by; use test_utils::tested_by;
use crate::{ use crate::{attr::Attrs, db::DefDatabase, path::ModPath, FileAstId, HirFileId, InFile};
attr::Attrs, db::DefDatabase, path::ModPath, FileAstId, HirFileId, InFile, LocalImportId,
}; #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub(super) struct LocalImportId(RawId);
impl_arena_id!(LocalImportId);
/// `RawItems` is a set of top-level items in a file (except for impls). /// `RawItems` is a set of top-level items in a file (except for impls).
/// ///