From 2c9c53a09b7d3f60f5640229400e3a2fa92aecc1 Mon Sep 17 00:00:00 2001 From: Joao Matos Date: Mon, 24 Jun 2024 14:31:58 +0100 Subject: [PATCH] Refactor type id insertion code in associated item/type root resolvers. --- .../src/semantic_analysis/namespace/root.rs | 26 ++++++------------- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/sway-core/src/semantic_analysis/namespace/root.rs b/sway-core/src/semantic_analysis/namespace/root.rs index 0b1c4331788..43b3ab35d1b 100644 --- a/sway-core/src/semantic_analysis/namespace/root.rs +++ b/sway-core/src/semantic_analysis/namespace/root.rs @@ -694,17 +694,12 @@ impl Root { self_type: Option, ) -> Result { let type_info = self.decl_to_type_info(handler, engines, symbol, decl)?; + let type_id = engines + .te() + .insert(engines, type_info, symbol.span().source_id()); self.resolve_associated_type_from_type_id( - handler, - engines, - module, - symbol, - engines - .te() - .insert(engines, type_info, symbol.span().source_id()), - as_trait, - self_type, + handler, engines, module, symbol, type_id, as_trait, self_type, ) } @@ -720,17 +715,12 @@ impl Root { self_type: Option, ) -> Result { let type_info = self.decl_to_type_info(handler, engines, symbol, decl)?; + let type_id = engines + .te() + .insert(engines, type_info, symbol.span().source_id()); self.resolve_associated_item_from_type_id( - handler, - engines, - module, - symbol, - engines - .te() - .insert(engines, type_info, symbol.span().source_id()), - as_trait, - self_type, + handler, engines, module, symbol, type_id, as_trait, self_type, ) }