Refactor Optimizer to use Folder
Extract common AST manipulation and folding logic into a new Folder struct. This improves code organization and reusability. The Optimizer now delegates these tasks to the Folder.
This commit is contained in:
@@ -143,6 +143,7 @@ impl UsageInfo {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct SubstitutionMap {
|
||||
pub values: HashMap<Address, Value>,
|
||||
pub ast_substitutions: HashMap<Address, AnalyzedNode>,
|
||||
@@ -155,15 +156,7 @@ pub struct SubstitutionMap {
|
||||
|
||||
impl SubstitutionMap {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
values: HashMap::new(),
|
||||
ast_substitutions: HashMap::new(),
|
||||
slot_mapping: HashMap::new(),
|
||||
assigned: HashSet::new(),
|
||||
next_slot: 0,
|
||||
used: HashSet::new(),
|
||||
captured_slots: HashSet::new(),
|
||||
}
|
||||
Self::default()
|
||||
}
|
||||
|
||||
pub fn add_ast_substitution(&mut self, addr: Address, node: AnalyzedNode) {
|
||||
|
||||
Reference in New Issue
Block a user