-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent infinite loops #344
Comments
👍 @retailcoder, shall we see how far we can push the parser? =;)- |
I read somewhere that ANTLR can evaluate conditions. I need to read up on it. |
If this inspection happens, expect a bunch of other ones too, like |
I mostly get this kind of error from setting up a do until .EOF loop for a recordset and forgetting to put in a .movenext. |
So there's separate kinds of infinite loops:
The earlier kind can be rather simply found by the Parser. In case of more complex expressions you could try to evaluate the loopcondition down. The latter kind requires more intrinsic knowledge of the context. What's necessary here is a more in-depth analysis (think path-analysis) |
@Vogel612 even constant condition is trickier than it looks, mostly because VBA's lowest scope level is at the procedure level - it would be simpler if a For loop defined a scope.. we might have to simulate that to achieve proper inspection of variable references, by adding some |
We're getting into semantic analysis at this point. Are we in a position to really do that? |
@ckuhn203 not reliably. But we can try and pick up the obvious ...although usefulness (of picking up blatantly infinite loops) vs. effort required makes this a not very much appealing feature to build. |
I've just lost 2 hours of work because of a forgotten |
I'm sorry to hear that, but are you aware that you don't need Rubberduck to bail you out -- just use Ctrl + Break to break the infinite loop. That would let you get into the code, and either stop or move the execution to some other line and resume or even add |
@bclothier Except that without |
It can be easy to make a small error that causes an infinite loop, which can mess up things and crash the VBE. It would be nice if Rubberduck could catch an infinite loop at compile time (or at another time besides run time, whichever is most ideal).
The text was updated successfully, but these errors were encountered: