Add Mapping::get to necessary expressions that are preserved by DCE

This commit is contained in:
Pranav Gaddamadugu 2024-03-29 08:25:46 -07:00
parent 06c24bbef9
commit 19eb828327

View File

@ -32,9 +32,9 @@ impl ExpressionReconstructor for DeadCodeEliminator<'_> {
/// Reconstructs the associated function access expression.
fn reconstruct_associated_function(&mut self, input: AssociatedFunction) -> (Expression, Self::AdditionalOutput) {
// If the associated function manipulates a mapping, mark the statement as necessary.
// If the associated function manipulates a mapping or has a side-effect, mark the statement as necessary.
match (&input.variant.name, input.name.name) {
(&sym::Mapping, sym::remove) | (&sym::Mapping, sym::set) => {
(&sym::Mapping, sym::remove) | (&sym::Mapping, sym::set) | (&sym::Mapping, sym::get) => {
self.is_necessary = true;
}
_ => {}