diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-11-11 14:41:41 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-11-11 14:41:41 -0300 |
commit | ab1aca94e83d2eff1605ea1854df023c814cef21 (patch) | |
tree | 16b87253f000cb0052133bf2e1ede3d4b2b730ef /testes | |
parent | d28265256110a0c5437247d443ddedc2a7aab116 (diff) | |
download | lua-ab1aca94e83d2eff1605ea1854df023c814cef21.tar.gz lua-ab1aca94e83d2eff1605ea1854df023c814cef21.tar.bz2 lua-ab1aca94e83d2eff1605ea1854df023c814cef21.zip |
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.
Diffstat (limited to 'testes')
-rw-r--r-- | testes/code.lua | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/testes/code.lua b/testes/code.lua index 34b04668..1f971cd7 100644 --- a/testes/code.lua +++ b/testes/code.lua | |||
@@ -392,28 +392,6 @@ check(function (a, b) | |||
392 | end, | 392 | end, |
393 | 'TEST', 'JMP', 'TEST', 'JMP', 'ADDI', 'MMBINI', 'JMP', 'RETURN0') | 393 | 'TEST', 'JMP', 'TEST', 'JMP', 'ADDI', 'MMBINI', 'JMP', 'RETURN0') |
394 | 394 | ||
395 | checkequal( | ||
396 | function (a) while a < 10 do a = a + 1 end end, | ||
397 | function (a) | ||
398 | ::loop:: | ||
399 | if not (a < 10) then goto exit end | ||
400 | a = a + 1 | ||
401 | goto loop | ||
402 | ::exit:: | ||
403 | end | ||
404 | ) | ||
405 | |||
406 | checkequal( | ||
407 | function (a) repeat local x = a + 1; a = x until a > 0 end, | ||
408 | function (a) | ||
409 | ::loop:: do | ||
410 | local x = a + 1 | ||
411 | a = x | ||
412 | end | ||
413 | if not (a > 0) then goto loop end | ||
414 | end | ||
415 | ) | ||
416 | |||
417 | checkequal(function () return 6 or true or nil end, | 395 | checkequal(function () return 6 or true or nil end, |
418 | function () return k6 or kTrue or kNil end) | 396 | function () return k6 or kTrue or kNil end) |
419 | 397 | ||