diff options
| author | Li Jin <dragon-fly@qq.com> | 2026-02-11 16:58:21 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2026-02-11 16:58:21 +0800 |
| commit | 663a8c622db13b3a9dad962071ff6f3cfb482de3 (patch) | |
| tree | bafb5d2bc4a62cf2fa5be6a1a6bb21b0160d1c29 /spec/outputs/5.1/loops.lua | |
| parent | f85c61c5ff06c43d74ccf3233f56c6e5dc576319 (diff) | |
| download | yuescript-663a8c622db13b3a9dad962071ff6f3cfb482de3.tar.gz yuescript-663a8c622db13b3a9dad962071ff6f3cfb482de3.tar.bz2 yuescript-663a8c622db13b3a9dad962071ff6f3cfb482de3.zip | |
Supported multiple break values. Simplified some generated codes.
Diffstat (limited to 'spec/outputs/5.1/loops.lua')
| -rw-r--r-- | spec/outputs/5.1/loops.lua | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/spec/outputs/5.1/loops.lua b/spec/outputs/5.1/loops.lua index e4f2871..019cd60 100644 --- a/spec/outputs/5.1/loops.lua +++ b/spec/outputs/5.1/loops.lua | |||
| @@ -499,25 +499,21 @@ local _anon_func_0 = function(i, tb) | |||
| 499 | end | 499 | end |
| 500 | do | 500 | do |
| 501 | local index | 501 | local index |
| 502 | do | 502 | for i = 1, #tb do |
| 503 | local _accum_0 | 503 | if tb[i] then |
| 504 | for i = 1, #tb do | 504 | index = i |
| 505 | if tb[i] then | 505 | break |
| 506 | _accum_0 = i | ||
| 507 | break | ||
| 508 | end | ||
| 509 | end | 506 | end |
| 510 | index = _accum_0 | ||
| 511 | end | 507 | end |
| 512 | f((function() | 508 | f((function() |
| 513 | local _accum_0 | 509 | local _val_0 |
| 514 | for i = 1, #tb do | 510 | for i = 1, #tb do |
| 515 | if tb[i] then | 511 | if tb[i] then |
| 516 | _accum_0 = i | 512 | _val_0 = i |
| 517 | break | 513 | break |
| 518 | end | 514 | end |
| 519 | end | 515 | end |
| 520 | return _accum_0 | 516 | return _val_0 |
| 521 | end)()) | 517 | end)()) |
| 522 | f((function() | 518 | f((function() |
| 523 | local _accum_0 = { } | 519 | local _accum_0 = { } |
| @@ -545,13 +541,13 @@ do | |||
| 545 | i = 1 | 541 | i = 1 |
| 546 | local idx | 542 | local idx |
| 547 | do | 543 | do |
| 548 | local _accum_0 | 544 | local _val_0 |
| 549 | while tb[i] do | 545 | while tb[i] do |
| 550 | i = i + 1 | 546 | i = i + 1 |
| 551 | _accum_0 = i - 1 | 547 | _val_0 = i - 1 |
| 552 | break | 548 | break |
| 553 | end | 549 | end |
| 554 | idx = _accum_0 | 550 | idx = _val_0 |
| 555 | end | 551 | end |
| 556 | local f1 | 552 | local f1 |
| 557 | f1 = function() | 553 | f1 = function() |
| @@ -560,13 +556,13 @@ do | |||
| 560 | end | 556 | end |
| 561 | i = 1 | 557 | i = 1 |
| 562 | f((function() | 558 | f((function() |
| 563 | local _accum_0 | 559 | local _val_0 |
| 564 | while tb[i] do | 560 | while tb[i] do |
| 565 | i = i + 1 | 561 | i = i + 1 |
| 566 | _accum_0 = i - 1 | 562 | _val_0 = i - 1 |
| 567 | break | 563 | break |
| 568 | end | 564 | end |
| 569 | return _accum_0 | 565 | return _val_0 |
| 570 | end)()) | 566 | end)()) |
| 571 | local _accum_0 = { } | 567 | local _accum_0 = { } |
| 572 | local _len_0 = 1 | 568 | local _len_0 = 1 |
| @@ -592,13 +588,13 @@ do | |||
| 592 | print(1) | 588 | print(1) |
| 593 | until true | 589 | until true |
| 594 | do | 590 | do |
| 595 | local _accum_0 | 591 | local _val_0 |
| 596 | repeat | 592 | repeat |
| 597 | a = func() | 593 | a = func() |
| 598 | _accum_0 = a.x | 594 | _val_0 = a.x |
| 599 | break | 595 | break |
| 600 | until a.v | 596 | until a.v |
| 601 | x = _accum_0 | 597 | x = _val_0 |
| 602 | end | 598 | end |
| 603 | local items | 599 | local items |
| 604 | local _accum_0 = { } | 600 | local _accum_0 = { } |
