From ecf97801d647329af13d9d5bb9312b20a2611077 Mon Sep 17 00:00:00 2001 From: John Date: Sat, 27 Apr 2024 16:10:22 -0500 Subject: [PATCH] cl-typeck: Use helper functions on module to insert into the various namespaces --- compiler/cl-typeck/src/name_collector.rs | 14 +++++++------- compiler/cl-typeck/src/type_resolver.rs | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/compiler/cl-typeck/src/name_collector.rs b/compiler/cl-typeck/src/name_collector.rs index 8726358..2f9b831 100644 --- a/compiler/cl-typeck/src/name_collector.rs +++ b/compiler/cl-typeck/src/name_collector.rs @@ -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); diff --git a/compiler/cl-typeck/src/type_resolver.rs b/compiler/cl-typeck/src/type_resolver.rs index 376c9c2..f0eaaca 100644 --- a/compiler/cl-typeck/src/type_resolver.rs +++ b/compiler/cl-typeck/src/type_resolver.rs @@ -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)) }