rename type to type_alias in the AST as well

This commit is contained in:
Aleksey Kladov 2019-02-25 13:38:52 +03:00
parent 7ffff9c74c
commit 78f10fcdc4
45 changed files with 293 additions and 108 deletions

View file

@ -619,7 +619,10 @@ pub struct TypeAlias {
}
impl TypeAlias {
pub fn source(&self, db: &impl PersistentHirDatabase) -> (HirFileId, TreeArc<ast::TypeDef>) {
pub fn source(
&self,
db: &impl PersistentHirDatabase,
) -> (HirFileId, TreeArc<ast::TypeAliasDef>) {
self.id.source(db)
}

View file

@ -22,7 +22,7 @@ pub struct HirInterner {
consts: LocationIntener<ItemLoc<ast::ConstDef>, ConstId>,
statics: LocationIntener<ItemLoc<ast::StaticDef>, StaticId>,
traits: LocationIntener<ItemLoc<ast::TraitDef>, TraitId>,
types: LocationIntener<ItemLoc<ast::TypeDef>, TypeId>,
types: LocationIntener<ItemLoc<ast::TypeAliasDef>, TypeId>,
}
impl HirInterner {
@ -278,8 +278,8 @@ impl AstItemDef<ast::TraitDef> for TraitId {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct TypeId(RawId);
impl_arena_id!(TypeId);
impl AstItemDef<ast::TypeDef> for TypeId {
fn interner(interner: &HirInterner) -> &LocationIntener<ItemLoc<ast::TypeDef>, Self> {
impl AstItemDef<ast::TypeAliasDef> for TypeId {
fn interner(interner: &HirInterner) -> &LocationIntener<ItemLoc<ast::TypeAliasDef>, Self> {
&interner.types
}
}

View file

@ -137,7 +137,7 @@ impl ImplData {
.map(|item_node| match item_node.kind() {
ast::ImplItemKind::FnDef(it) => Function { id: ctx.to_def(it) }.into(),
ast::ImplItemKind::ConstDef(it) => Const { id: ctx.to_def(it) }.into(),
ast::ImplItemKind::TypeDef(it) => TypeAlias { id: ctx.to_def(it) }.into(),
ast::ImplItemKind::TypeAliasDef(it) => TypeAlias { id: ctx.to_def(it) }.into(),
})
.collect()
} else {

View file

@ -167,7 +167,7 @@ impl LoweredModule {
self.declarations.insert(name.as_name(), PerNs::types(t.into()));
}
}
ast::ModuleItemKind::TypeDef(it) => {
ast::ModuleItemKind::TypeAliasDef(it) => {
if let Some(name) = it.name() {
let t = TypeAlias { id: ctx.to_def(it) };
self.declarations.insert(name.as_name(), PerNs::types(t.into()));