diff options
Diffstat (limited to 'testes/code.lua')
-rw-r--r-- | testes/code.lua | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/testes/code.lua b/testes/code.lua index 08b3e23f..50ce7392 100644 --- a/testes/code.lua +++ b/testes/code.lua | |||
@@ -412,13 +412,22 @@ checkequal(function (l) local a; return 0 <= a and a <= l end, | |||
412 | function (l) local a; return not (not(a >= 0) or not(a <= l)) end) | 412 | function (l) local a; return not (not(a >= 0) or not(a <= l)) end) |
413 | 413 | ||
414 | 414 | ||
415 | -- if-break optimizations | ||
416 | check(function (a, b) | 415 | check(function (a, b) |
417 | while a do | 416 | while a do |
418 | if b then break else a = a + 1 end | 417 | if b then break else a = a + 1 end |
419 | end | 418 | end |
420 | end, | 419 | end, |
421 | 'TEST', 'JMP', 'TEST', 'JMP', 'ADDI', 'MMBINI', 'JMP', 'RETURN0') | 420 | 'TEST', 'JMP', 'TEST', 'JMP', 'JMP', 'CLOSE', 'JMP', 'ADDI', 'MMBINI', 'JMP', 'RETURN0') |
421 | |||
422 | check(function () | ||
423 | do | ||
424 | goto exit -- don't need to close | ||
425 | local x <close> = nil | ||
426 | goto exit -- must close | ||
427 | end | ||
428 | ::exit:: | ||
429 | end, 'JMP', 'CLOSE', 'LOADNIL', 'TBC', | ||
430 | 'CLOSE', 'JMP', 'CLOSE', 'RETURN') | ||
422 | 431 | ||
423 | checkequal(function () return 6 or true or nil end, | 432 | checkequal(function () return 6 or true or nil end, |
424 | function () return k6 or kTrue or kNil end) | 433 | function () return k6 or kTrue or kNil end) |