mirror of
https://github.com/lua/lua.git
synced 2025-07-04 07:03:24 +00:00
Removed optimization for «if ... then goto»
That optimization was too complex and caused some weird traces when debugging. The more common case «if ... then break» was kept.
This commit is contained in:
parent
d282652561
commit
ab1aca94e8
2 changed files with 6 additions and 66 deletions
|
@ -392,28 +392,6 @@ check(function (a, b)
|
|||
end,
|
||||
'TEST', 'JMP', 'TEST', 'JMP', 'ADDI', 'MMBINI', 'JMP', 'RETURN0')
|
||||
|
||||
checkequal(
|
||||
function (a) while a < 10 do a = a + 1 end end,
|
||||
function (a)
|
||||
::loop::
|
||||
if not (a < 10) then goto exit end
|
||||
a = a + 1
|
||||
goto loop
|
||||
::exit::
|
||||
end
|
||||
)
|
||||
|
||||
checkequal(
|
||||
function (a) repeat local x = a + 1; a = x until a > 0 end,
|
||||
function (a)
|
||||
::loop:: do
|
||||
local x = a + 1
|
||||
a = x
|
||||
end
|
||||
if not (a > 0) then goto loop end
|
||||
end
|
||||
)
|
||||
|
||||
checkequal(function () return 6 or true or nil end,
|
||||
function () return k6 or kTrue or kNil end)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue