JetBrains/kotlin — pull request #149 by Spasi (2012-12-06 22:36:44+00:00)
Title: Fix for KT-3141

This commit fixes http://youtrack.jetbrains.com/issue/KT-3141.

It's a simple conversion from recursion to iteration using a Guava Deque as a stack. I was not sure whether or not iteration order is important, so I reverse the previous/next instruction collections to make sure the traversal exactly matches the original recursive version. If this is not a requirement, you may remove the local list and the call to Lists.reverse.