On Tue Jun 27 13:15:42 2023 +0000, Giovanni Mascellani wrote:
I agree. Would it be feasible to immediately store somewhere in the context the iteration code when parsing `for (...; ...; ...)` (before parsing the body), and then immediately copy it each time it is needed while parsing the body, therefore removing the need for a double pass? That might require some refactoring, but shouldn't be too difficult. Similarly, I don't like too much the fact that the `continue`/`break` validation is done in a different pass. The frontend should be responsible for creating valid IR in the first place. If you refactor the code the way I said you can avoid that, simply by keeping a boolean telling you whether you are in a loop or not.
I was initially opposed to storing the context like that, but reconsidering, I guess I don't have a good reason to be opposed to it.