[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Added `continue` keyword to Lua 5.4 [code review requested].
- From: Roberto Ierusalimschy <roberto@...>
- Date: Mon, 20 Mar 2023 17:59:59 -0300
> 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.