Fix bug in optimizer for if statements with empty true blocks.
This commit is contained in:
parent
5879f467d8
commit
db59aed14e
@ -149,7 +149,7 @@ fn call_fn_with_constant_arguments(
|
|||||||
fn optimize_stmt(stmt: Stmt, state: &mut State, preserve_result: bool) -> Stmt {
|
fn optimize_stmt(stmt: Stmt, state: &mut State, preserve_result: bool) -> Stmt {
|
||||||
match stmt {
|
match stmt {
|
||||||
// if expr { Noop }
|
// if expr { Noop }
|
||||||
Stmt::IfThenElse(x) if matches!(x.1, Stmt::Noop(_)) => {
|
Stmt::IfThenElse(x) if matches!(x.1, Stmt::Noop(_)) && x.2.is_none() => {
|
||||||
state.set_dirty();
|
state.set_dirty();
|
||||||
|
|
||||||
let pos = x.0.position();
|
let pos = x.0.position();
|
||||||
|
Loading…
Reference in New Issue
Block a user