Skip to content

Commit

Permalink
Small refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniosarosi committed Nov 30, 2024
1 parent e508af1 commit 4bcc942
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
5 changes: 3 additions & 2 deletions engine/baml-lib/baml-core/src/ir/repr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ use crate::Configuration;
pub struct IntermediateRepr {
enums: Vec<Node<Enum>>,
classes: Vec<Node<Class>>,
/// Strongly connected components of the dependency graph (finite cycles).
finite_recursive_cycles: Vec<IndexSet<String>>,
functions: Vec<Node<Function>>,
clients: Vec<Node<Client>>,
retry_policies: Vec<Node<RetryPolicy>>,
template_strings: Vec<Node<TemplateString>>,

/// Strongly connected components of the dependency graph (finite cycles).
finite_recursive_cycles: Vec<IndexSet<String>>,

configuration: Configuration,
}

Expand Down
16 changes: 0 additions & 16 deletions engine/baml-lib/parser-database/src/walkers/alias.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<TypeWalker<'db>> {
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,
}
}
}

0 comments on commit 4bcc942

Please sign in to comment.