2019-04-23 07:49:16 +00:00
|
|
|
{
|
|
|
|
let x := 1
|
|
|
|
let y := 2
|
|
|
|
let a := 3
|
|
|
|
let b := 4
|
|
|
|
for {} 1 {} {
|
|
|
|
for {} 1 {} {
|
|
|
|
for {} 1 {} {
|
|
|
|
// Here, the nesting is not yet too deep, so the assignment
|
|
|
|
// should be removed.
|
|
|
|
for {} 1 { x := 9 } {
|
|
|
|
y := 10
|
|
|
|
for {} 1 {} {
|
|
|
|
for {} 1 {} {
|
|
|
|
// Now we are too deep, assignments stay.
|
|
|
|
for {} 1 { a := 10 } {
|
|
|
|
b := 12
|
|
|
|
b := 11
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
x := 13
|
|
|
|
}
|
|
|
|
// ====
|
|
|
|
// step: redundantAssignEliminator
|
|
|
|
// ----
|
|
|
|
// {
|
|
|
|
// let x := 1
|
|
|
|
// let y := 2
|
|
|
|
// let a := 3
|
|
|
|
// let b := 4
|
2019-05-08 10:41:19 +00:00
|
|
|
// for { } 1 { }
|
2019-04-23 07:49:16 +00:00
|
|
|
// {
|
2019-05-08 10:41:19 +00:00
|
|
|
// for { } 1 { }
|
2019-04-23 07:49:16 +00:00
|
|
|
// {
|
2019-05-08 10:41:19 +00:00
|
|
|
// for { } 1 { }
|
2019-04-23 07:49:16 +00:00
|
|
|
// {
|
2019-05-08 10:41:19 +00:00
|
|
|
// for { } 1 { }
|
2019-04-23 07:49:16 +00:00
|
|
|
// {
|
2019-05-08 10:41:19 +00:00
|
|
|
// for { } 1 { }
|
2019-04-23 07:49:16 +00:00
|
|
|
// {
|
2019-05-08 10:41:19 +00:00
|
|
|
// for { } 1 { }
|
2019-04-23 07:49:16 +00:00
|
|
|
// {
|
2019-05-08 10:41:19 +00:00
|
|
|
// for { } 1 { a := 10 }
|
2019-04-23 07:49:16 +00:00
|
|
|
// {
|
|
|
|
// b := 12
|
|
|
|
// b := 11
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|