Skip to content

Commit

Permalink
Rename queue -> stack
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniosarosi committed Feb 24, 2025
1 parent fba01c5 commit bb4826c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions engine/baml-lib/baml-core/src/ir/repr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -621,8 +621,8 @@ impl WithRepr<FieldType> for ast::FieldType {

let mut symbol_spans = HashMap::new();

let mut queue = vec![self];
while let Some(item) = queue.pop() {
let mut stack = vec![self];
while let Some(item) = stack.pop() {
match item {
// Base case, store span.
ast::FieldType::Symbol(_, idn, ..) => {
Expand All @@ -636,14 +636,14 @@ impl WithRepr<FieldType> for ast::FieldType {
}
}
// Recurse.
ast::FieldType::List(_, ft, ..) => queue.push(ft),
ast::FieldType::List(_, ft, ..) => stack.push(ft),
ast::FieldType::Map(_, kv, ..) => {
let (k, v) = &**kv;
queue.push(k);
queue.push(v);
stack.push(k);
stack.push(v);
}
ast::FieldType::Union(_, items, ..) | ast::FieldType::Tuple(_, items, ..) => {
queue.extend(items.iter());
stack.extend(items.iter());
}
// No identifiers here.
ast::FieldType::Primitive(..) | ast::FieldType::Literal(..) => {}
Expand Down

0 comments on commit bb4826c

Please sign in to comment.