Skip to content

Commit

Permalink
Translate array reference to poly ID
Browse files Browse the repository at this point in the history
  • Loading branch information
georgwiese committed Nov 7, 2024
1 parent ff9a098 commit 82a97f8
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion pilopt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,23 @@ fn collect_required_symbols<'a, T: FieldElement>(
.values()
.map(|p| SymbolReference::from(&p.polynomial.name)),
);

let poly_ref_to_id = pil_file
.definitions
.values()
.filter_map(|(symbol, _)| matches!(symbol.kind, SymbolKind::Poly(_)).then_some(symbol))
.flat_map(|symbol| symbol.array_elements())
.collect::<BTreeMap<_, _>>();

for fun in &pil_file.prover_functions {
for e in fun.all_children() {
if let Expression::Reference(_, Reference::Poly(poly_ref)) = e {
required_names.insert(SymbolReference::from(poly_ref));
let symbol_ref = match poly_ref_to_id.get(&poly_ref.name) {
Some(poly_id) => poly_id_to_definition_name[poly_id].into(),
None => SymbolReference::from(poly_ref),
};

required_names.insert(symbol_ref);
}
}
}
Expand Down

0 comments on commit 82a97f8

Please sign in to comment.