From 10e51da430034c1d3bc8d8048ba8248271d27ed8 Mon Sep 17 00:00:00 2001 From: Ryan Pitasky <111201305+rpitasky@users.noreply.github.com> Date: Sun, 1 Dec 2024 23:06:14 -0500 Subject: [PATCH] bugfix: IfThens can have paren optimizations too --- test-files/snippets/optimize/parentheses/maximization/3.txt | 1 + .../src/optimize/expressions/parenthesis_optimization.rs | 1 + 2 files changed, 2 insertions(+) create mode 100644 test-files/snippets/optimize/parentheses/maximization/3.txt diff --git a/test-files/snippets/optimize/parentheses/maximization/3.txt b/test-files/snippets/optimize/parentheses/maximization/3.txt new file mode 100644 index 0000000..a0d3b59 --- /dev/null +++ b/test-files/snippets/optimize/parentheses/maximization/3.txt @@ -0,0 +1 @@ +Ans=267-(262-H)G \ No newline at end of file diff --git a/ti-basic-optimizer/src/optimize/expressions/parenthesis_optimization.rs b/ti-basic-optimizer/src/optimize/expressions/parenthesis_optimization.rs index c6bcab7..b264b6c 100644 --- a/ti-basic-optimizer/src/optimize/expressions/parenthesis_optimization.rs +++ b/ti-basic-optimizer/src/optimize/expressions/parenthesis_optimization.rs @@ -163,6 +163,7 @@ impl Statement { Statement::ControlFlow(control_flow) => { match control_flow { ControlFlow::If(expr) + | ControlFlow::IfThen(expr) | ControlFlow::While(expr) | ControlFlow::Repeat(expr) => { expr.optimize_parentheses();