From 4bcc9423469dd75fefa2c5f16f4c3a4824df70c5 Mon Sep 17 00:00:00 2001 From: Antonio Sarosi Date: Sun, 1 Dec 2024 00:34:43 +0100 Subject: [PATCH] Small refactor --- engine/baml-lib/baml-core/src/ir/repr.rs | 5 +++-- .../parser-database/src/walkers/alias.rs | 16 ---------------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/engine/baml-lib/baml-core/src/ir/repr.rs b/engine/baml-lib/baml-core/src/ir/repr.rs index 8b8971864..64431059c 100644 --- a/engine/baml-lib/baml-core/src/ir/repr.rs +++ b/engine/baml-lib/baml-core/src/ir/repr.rs @@ -27,13 +27,14 @@ use crate::Configuration; pub struct IntermediateRepr { enums: Vec>, classes: Vec>, - /// Strongly connected components of the dependency graph (finite cycles). - finite_recursive_cycles: Vec>, functions: Vec>, clients: Vec>, retry_policies: Vec>, template_strings: Vec>, + /// Strongly connected components of the dependency graph (finite cycles). + finite_recursive_cycles: Vec>, + configuration: Configuration, } diff --git a/engine/baml-lib/parser-database/src/walkers/alias.rs b/engine/baml-lib/parser-database/src/walkers/alias.rs index cd0fbc469..8ba968dfc 100644 --- a/engine/baml-lib/parser-database/src/walkers/alias.rs +++ b/engine/baml-lib/parser-database/src/walkers/alias.rs @@ -23,20 +23,4 @@ impl<'db> TypeAliasWalker<'db> { pub fn resolved(&self) -> &'db FieldType { &self.db.types.resolved_type_aliases[&self.id] } - - /// Returns a [`TypeWalker`] over the resolved type if it's a symbol. - /// - /// # Panics - /// - /// Panics if the resolved type is a symbol but the symbol is not found. - pub fn resolved_as_walker(&self) -> Option> { - match self.resolved() { - FieldType::Symbol(_, ident, _) => match self.db.find_type_by_str(ident.name()) { - Some(walker) => Some(walker), - _ => panic!("Unknown class or enum `{ident}`"), - }, - - _ => None, - } - } }