This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse the repository at this point in the history
[Truffle] Fixed an issue with nesting while statements and breaks.
Our translator keeps track of break statements inside of whiles via the 'translatingWhile' boolean flag. Prior to this change, whenever we finished visiting a while node we'd reset the boolean to false. This presented a problem for code with nested while loops and a break statement in the outer while, but outside and after the body of the inner while. The inner while would reset the value and when we visited the break node we'd erroneously think it was outside the body of any while node. By restoring the flag value when we exit, we can keep track through arbitrarily nested whiles. This assumes the default value is 'false', which it is.
- Loading branch information
Showing 1 changed file with 2 additions and 1 deletion.