Expose functions to access free and manipulate variable declarations

This commit is contained in:
Patrick Lühne 2020-04-17 03:18:25 +02:00
parent 8a9a7b9132
commit 63c1931e30
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF

View File

@ -118,7 +118,19 @@ impl<'p> VariableDeclarationStackLayer<'p>
} }
} }
#[cfg(test)] pub fn free_variable_declarations_do_mut<F, G>(&self, f: F) -> G
where
F: Fn(&mut crate::VariableDeclarations) -> G
{
match self
{
VariableDeclarationStackLayer::Free(free_variable_declarations)
=> f(&mut free_variable_declarations.borrow_mut()),
VariableDeclarationStackLayer::Bound(bound_variable_declarations)
=> bound_variable_declarations.parent.free_variable_declarations_do_mut(f),
}
}
pub fn free_variable_declarations_do<F, G>(&self, f: F) -> G pub fn free_variable_declarations_do<F, G>(&self, f: F) -> G
where where
F: Fn(&crate::VariableDeclarations) -> G F: Fn(&crate::VariableDeclarations) -> G