cl-typeck: Use helper functions on module to insert into the various namespaces

This commit is contained in:
John 2024-04-27 16:10:22 -05:00
parent 71745161c4
commit ecf97801d6
2 changed files with 8 additions and 8 deletions

View File

@ -56,7 +56,7 @@ impl<'prj, 'a> Visit<'a> for NameCollector<'prj, 'a> {
let def = Def { name: *name, module: Mod::new(*parent), ..Default::default() };
let id = prj.pool.insert(def);
prj[*parent].module.types.insert(*name, id);
prj[*parent].module.insert_type(*name, id);
self.with_parent(id, kind, Self::visit_module_kind);
self.retval = Some(id);
@ -67,7 +67,7 @@ impl<'prj, 'a> Visit<'a> for NameCollector<'prj, 'a> {
let def = Def { name: *name, module: Mod::new(*parent), ..Default::default() };
let id = prj.pool.insert(def);
prj[*parent].module.types.insert(*name, id);
prj[*parent].module.insert_type(*name, id);
self.retval = Some(id);
}
@ -77,7 +77,7 @@ impl<'prj, 'a> Visit<'a> for NameCollector<'prj, 'a> {
let def = Def { name: *name, module: Mod::new(*parent), ..Default::default() };
let id = prj.pool.insert(def);
prj[*parent].module.types.insert(*name, id);
prj[*parent].module.insert_type(*name, id);
self.with_parent(id, kind, Self::visit_enum_kind);
self.retval = Some(id);
@ -88,7 +88,7 @@ impl<'prj, 'a> Visit<'a> for NameCollector<'prj, 'a> {
let def = Def { name: *name, module: Mod::new(*parent), ..Default::default() };
let id = prj.pool.insert(def);
prj[*parent].module.types.insert(*name, id);
prj[*parent].module.insert_type(*name, id);
self.with_parent(id, kind, Self::visit_struct_kind);
self.retval = Some(id);
@ -99,7 +99,7 @@ impl<'prj, 'a> Visit<'a> for NameCollector<'prj, 'a> {
let def = Def { name: *name, module: Mod::new(*parent), ..Default::default() };
let id = prj.pool.insert(def);
prj[*parent].module.values.insert(*name, id);
prj[*parent].module.insert_value(*name, id);
self.with_parent(id, &**init, Self::visit_expr);
self.retval = Some(id);
@ -110,7 +110,7 @@ impl<'prj, 'a> Visit<'a> for NameCollector<'prj, 'a> {
let def = Def { name: *name, module: Mod::new(*parent), ..Default::default() };
let id = prj.pool.insert(def);
prj[*parent].module.values.insert(*name, id);
prj[*parent].module.insert_value(*name, id);
self.with_parent(id, &**init, Self::visit_expr);
self.retval = Some(id);
@ -121,7 +121,7 @@ impl<'prj, 'a> Visit<'a> for NameCollector<'prj, 'a> {
let def = Def { name: *name, module: Mod::new(*parent), ..Default::default() };
let id = prj.pool.insert(def);
prj[*parent].module.values.insert(*name, id);
prj[*parent].module.insert_value(*name, id);
if let Some(body) = body {
self.with_parent(id, body, Self::visit_block);

View File

@ -194,7 +194,7 @@ impl<'a> TypeResolvable<'a> for Variant {
let new_id = prj.pool.insert(def);
// Insert the struct variant type into the enum's namespace
prj[id].module.types.insert(*name, new_id);
prj[id].module.insert_type(*name, new_id);
Ok(Some(new_id))
}