Just in case I've implemented the 'continue' statement (and others) for LJS[JIT] from 5.1 to 5.4:
Makes sense, thanks for the explanation. In that case, I will add a corresponding optimization for "if cond then continue ...". And now looking at my patch, I wrote a bug in that function which actually causes a test failure; I've attached the corrected patch.
On Mon, Mar 20, 2023 at 5:00 PM Roberto Ierusalimschy <firstname.lastname@example.org> wrote:
> In the absence of a code review, would anyone know the purpose of the
> `break` keyword handling in the `test_then_block` method? I am curious to
> know what that does so I know whether to modify it or not. From what I can
> see, the `continue` keyword seems to work properly whether I update that
> method or not, so I'm wondering if it is simply some kind of optimization
> for special cases.
Yes, it is an optimization for the case "if cond then break ...". Without
the optimization, the "if" would jump around 'break' when the condition
is false. With the optimization, the "if" jumps straight to the end of
the loop when the condition is true.