use crate::{CallGraph, StructGraph, SymbolTable};
use leo_ast::Function;
use leo_span::Symbol;
use indexmap::IndexMap;
pub struct CodeGenerator<'a> {
pub(crate) symbol_table: &'a SymbolTable,
pub(crate) struct_graph: &'a StructGraph,
pub(crate) _call_graph: &'a CallGraph,
pub(crate) next_register: u64,
pub(crate) current_function: Option<&'a Function>,
pub(crate) variable_mapping: IndexMap<&'a Symbol, String>,
pub(crate) composite_mapping: IndexMap<&'a Symbol, (bool, String)>,
pub(crate) global_mapping: IndexMap<&'a Symbol, String>,
pub(crate) is_transition_function: bool,
pub(crate) in_finalize: bool,
}
impl<'a> CodeGenerator<'a> {
pub fn new(symbol_table: &'a SymbolTable, struct_graph: &'a StructGraph, _call_graph: &'a CallGraph) -> Self {
Self {
symbol_table,
struct_graph,
_call_graph,
next_register: 0,
current_function: None,
variable_mapping: IndexMap::new(),
composite_mapping: IndexMap::new(),
global_mapping: IndexMap::new(),
is_transition_function: false,
in_finalize: false,
}
}
}