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