use leo_ast::*;
use super::UnrollingVisitor;
impl ProgramReconstructor for UnrollingVisitor<'_> {
fn reconstruct_stub(&mut self, input: Stub) -> Stub {
self.program = input.stub_id.name.name;
Stub {
functions: input.functions.into_iter().map(|(i, f)| (i, self.reconstruct_function_stub(f))).collect(),
..input
}
}
fn reconstruct_program_scope(&mut self, input: ProgramScope) -> ProgramScope {
self.program = input.program_id.name.name;
ProgramScope {
functions: input.functions.into_iter().map(|(i, f)| (i, self.reconstruct_function(f))).collect(),
..input
}
}
fn reconstruct_function(&mut self, function: Function) -> Function {
self.in_scope(function.id(), |slf| Function { block: slf.reconstruct_block(function.block).0, ..function })
}
}