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:
Roberto Ierusalimschy 2020-11-11 14:41:41 -03:00
parent d282652561
commit ab1aca94e8
2 changed files with 6 additions and 66 deletions

View file

@ -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)