Skip to content

Commit

Permalink
Add AllVariables mode for RemoveTemporaryVars.
Browse files Browse the repository at this point in the history
  • Loading branch information
SomeRanDev committed Jan 13, 2025
1 parent 3e270ce commit 2b3057d
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ enum RemoveTemporaryVariablesMode {
```
**/
AllOneUseVariables;

/**
All variables are removed. Each usage of a variable
is replaced with its assigned value.
**/
AllVariables;
}

class RemoveTemporaryVariablesImpl {
Expand Down Expand Up @@ -198,6 +204,7 @@ class RemoveTemporaryVariablesImpl {
case OnlyAvoidTemporaryFieldAccess: shouldRemoveVariableBeauseAvoidTemporaries(tvar, maybeExpr);
case AllTempVariables if(count < 2): tvar.name.startsWith("temp");
case AllOneUseVariables if(count < 2): true;
case AllVariables: true;
case _: false;
}
}
Expand Down

0 comments on commit 2b3057d

Please sign in to comment.