[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: patch to goto optional semicolon changing opcodes
- From: Roberto Ierusalimschy <roberto@...>
- Date: Sat, 19 May 2012 10:42:57 -0300
> I don't really consider this a bug (obviously) but hopefully Lua 5.2.1
> can include this.
Note that the syntax in Lua 5.2 changed; now a 'break' does not need to
be the last statement in a block. So, there is no "optional semicolon"
after the break, but an empty statement. All the following examples are
for i = 1, 2 do if true then break;;; end end
for i = 1, 2 do if true then break a = 3 end end
for i = 1, 2 do if true then break; a = 3 end end
for i = 1, 2 do if true then break; ::label:: ; end end
Some of those cases need the extra JMP, some do not. Some people may
consider that "break;" is a common case to deserve a special treatment,
but it would be better to handle the general case.