Skip to content

Commit

Permalink
make an eval method
Browse files Browse the repository at this point in the history
  • Loading branch information
vezenovm committed Jan 8, 2025
1 parent 73ceea5 commit cbe377e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions compiler/noirc_evaluator/src/ssa/ssa_gen/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1278,11 +1278,7 @@ impl GlobalsContext {

for (element, _) in elements {
element.for_each(|element| {
// let element = element.eval(self);
let element = match element {
Value::Normal(value) => value,
_ => panic!("Must have Value::Normal for globals"),
};
let element = Self::eval(element);
array.push_back(element);
});
}
Expand All @@ -1299,4 +1295,11 @@ impl GlobalsContext {
self.dfg.make_instruction(Instruction::MakeArray { elements, typ: typ.clone() }, None);
self.dfg.instruction_results(id)[0]
}

fn eval(value: Value) -> ValueId {
match value {
Value::Normal(value) => value,
_ => panic!("Must have Value::Normal for globals"),
}
}
}

0 comments on commit cbe377e

Please sign in to comment.