diff options
author | Li Jin <dragon-fly@qq.com> | 2024-03-25 08:25:06 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2024-03-25 08:25:06 +0800 |
commit | 21004f1fb9b2f6129a231a6c8d99179f0d6e3edf (patch) | |
tree | d94c69b9758e0e8ff38dc5f23bc888d084846110 /spec/outputs/codes_from_doc.lua | |
parent | 4e3656da3711fd045fdf90dec7084bd4556c5b7f (diff) | |
download | yuescript-21004f1fb9b2f6129a231a6c8d99179f0d6e3edf.tar.gz yuescript-21004f1fb9b2f6129a231a6c8d99179f0d6e3edf.tar.bz2 yuescript-21004f1fb9b2f6129a231a6c8d99179f0d6e3edf.zip |
remove one more redundant 'do' block from destructuring.
Diffstat (limited to 'spec/outputs/codes_from_doc.lua')
-rw-r--r-- | spec/outputs/codes_from_doc.lua | 104 |
1 files changed, 38 insertions, 66 deletions
diff --git a/spec/outputs/codes_from_doc.lua b/spec/outputs/codes_from_doc.lua index 1f593db..ca54086 100644 --- a/spec/outputs/codes_from_doc.lua +++ b/spec/outputs/codes_from_doc.lua | |||
@@ -359,10 +359,8 @@ do | |||
359 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | 359 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt |
360 | end | 360 | end |
361 | local one, two, ch | 361 | local one, two, ch |
362 | do | 362 | local _obj_0 = require("export") |
363 | local _obj_0 = require("export") | 363 | one, two, ch = _obj_0[1], _obj_0[2], _obj_0.Something.umm[1] |
364 | one, two, ch = _obj_0[1], _obj_0[2], _obj_0.Something.umm[1] | ||
365 | end | ||
366 | end | 364 | end |
367 | local _module_0 = { } | 365 | local _module_0 = { } |
368 | local a, b, c = 1, 2, 3 | 366 | local a, b, c = 1, 2, 3 |
@@ -527,36 +525,26 @@ local obj2 = { | |||
527 | local first, second = obj2.numbers[1], obj2.numbers[2] | 525 | local first, second = obj2.numbers[1], obj2.numbers[2] |
528 | print(first, second, color) | 526 | print(first, second, color) |
529 | local first, second, color | 527 | local first, second, color |
530 | do | 528 | local _obj_0 = obj2 |
531 | local _obj_0 = obj2 | 529 | first, second, color = _obj_0.numbers[1], _obj_0.numbers[2], _obj_0.properties.color |
532 | first, second, color = _obj_0.numbers[1], _obj_0.numbers[2], _obj_0.properties.color | ||
533 | end | ||
534 | local concat, insert | 530 | local concat, insert |
535 | do | 531 | local _obj_0 = table |
536 | local _obj_0 = table | 532 | concat, insert = _obj_0.concat, _obj_0.insert |
537 | concat, insert = _obj_0.concat, _obj_0.insert | ||
538 | end | ||
539 | local mix, max, rand | 533 | local mix, max, rand |
540 | do | 534 | local _obj_0 = math |
541 | local _obj_0 = math | 535 | mix, max, rand = _obj_0.mix, _obj_0.max, _obj_0.random |
542 | mix, max, rand = _obj_0.mix, _obj_0.max, _obj_0.random | ||
543 | end | ||
544 | local name, job | 536 | local name, job |
545 | do | 537 | local _obj_0 = person |
546 | local _obj_0 = person | 538 | name, job = _obj_0.name, _obj_0.job |
547 | name, job = _obj_0.name, _obj_0.job | 539 | if name == nil then |
548 | if name == nil then | 540 | name = "nameless" |
549 | name = "nameless" | ||
550 | end | ||
551 | if job == nil then | ||
552 | job = "jobless" | ||
553 | end | ||
554 | end | 541 | end |
555 | local two, four | 542 | if job == nil then |
556 | do | 543 | job = "jobless" |
557 | local _obj_0 = items | ||
558 | two, four = _obj_0[2], _obj_0[4] | ||
559 | end | 544 | end |
545 | local two, four | ||
546 | local _obj_0 = items | ||
547 | two, four = _obj_0[2], _obj_0[4] | ||
560 | local tuples = { | 548 | local tuples = { |
561 | { | 549 | { |
562 | "hello", | 550 | "hello", |
@@ -647,10 +635,8 @@ local _ <close> = setmetatable({ }, { | |||
647 | end | 635 | end |
648 | }) | 636 | }) |
649 | local a, b, c, d | 637 | local a, b, c, d |
650 | do | 638 | local _obj_0 = tb |
651 | local _obj_0 = tb | 639 | a, b, c, d = _obj_0.a, _obj_0.b, _obj_0[1], _obj_0[2] |
652 | a, b, c, d = _obj_0.a, _obj_0.b, _obj_0[1], _obj_0[2] | ||
653 | end | ||
654 | local some_string = "Here is a string\n that has a line break in it." | 640 | local some_string = "Here is a string\n that has a line break in it." |
655 | print("I am " .. tostring(math.random() * 100) .. "% sure.") | 641 | print("I am " .. tostring(math.random() * 100) .. "% sure.") |
656 | local integer = 1000000 | 642 | local integer = 1000000 |
@@ -2360,10 +2346,8 @@ do | |||
2360 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | 2346 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt |
2361 | end | 2347 | end |
2362 | local one, two, ch | 2348 | local one, two, ch |
2363 | do | 2349 | local _obj_0 = require("export") |
2364 | local _obj_0 = require("export") | 2350 | one, two, ch = _obj_0[1], _obj_0[2], _obj_0.Something.umm[1] |
2365 | one, two, ch = _obj_0[1], _obj_0[2], _obj_0.Something.umm[1] | ||
2366 | end | ||
2367 | end | 2351 | end |
2368 | local _module_0 = { } | 2352 | local _module_0 = { } |
2369 | local a, b, c = 1, 2, 3 | 2353 | local a, b, c = 1, 2, 3 |
@@ -2528,36 +2512,26 @@ local obj2 = { | |||
2528 | local first, second = obj2.numbers[1], obj2.numbers[2] | 2512 | local first, second = obj2.numbers[1], obj2.numbers[2] |
2529 | print(first, second, color) | 2513 | print(first, second, color) |
2530 | local first, second, color | 2514 | local first, second, color |
2531 | do | 2515 | local _obj_0 = obj2 |
2532 | local _obj_0 = obj2 | 2516 | first, second, color = _obj_0.numbers[1], _obj_0.numbers[2], _obj_0.properties.color |
2533 | first, second, color = _obj_0.numbers[1], _obj_0.numbers[2], _obj_0.properties.color | ||
2534 | end | ||
2535 | local concat, insert | 2517 | local concat, insert |
2536 | do | 2518 | local _obj_0 = table |
2537 | local _obj_0 = table | 2519 | concat, insert = _obj_0.concat, _obj_0.insert |
2538 | concat, insert = _obj_0.concat, _obj_0.insert | ||
2539 | end | ||
2540 | local mix, max, rand | 2520 | local mix, max, rand |
2541 | do | 2521 | local _obj_0 = math |
2542 | local _obj_0 = math | 2522 | mix, max, rand = _obj_0.mix, _obj_0.max, _obj_0.random |
2543 | mix, max, rand = _obj_0.mix, _obj_0.max, _obj_0.random | ||
2544 | end | ||
2545 | local name, job | 2523 | local name, job |
2546 | do | 2524 | local _obj_0 = person |
2547 | local _obj_0 = person | 2525 | name, job = _obj_0.name, _obj_0.job |
2548 | name, job = _obj_0.name, _obj_0.job | 2526 | if name == nil then |
2549 | if name == nil then | 2527 | name = "nameless" |
2550 | name = "nameless" | ||
2551 | end | ||
2552 | if job == nil then | ||
2553 | job = "jobless" | ||
2554 | end | ||
2555 | end | 2528 | end |
2556 | local two, four | 2529 | if job == nil then |
2557 | do | 2530 | job = "jobless" |
2558 | local _obj_0 = items | ||
2559 | two, four = _obj_0[2], _obj_0[4] | ||
2560 | end | 2531 | end |
2532 | local two, four | ||
2533 | local _obj_0 = items | ||
2534 | two, four = _obj_0[2], _obj_0[4] | ||
2561 | local tuples = { | 2535 | local tuples = { |
2562 | { | 2536 | { |
2563 | "hello", | 2537 | "hello", |
@@ -2648,10 +2622,8 @@ local _ <close> = setmetatable({ }, { | |||
2648 | end | 2622 | end |
2649 | }) | 2623 | }) |
2650 | local a, b, c, d | 2624 | local a, b, c, d |
2651 | do | 2625 | local _obj_0 = tb |
2652 | local _obj_0 = tb | 2626 | a, b, c, d = _obj_0.a, _obj_0.b, _obj_0[1], _obj_0[2] |
2653 | a, b, c, d = _obj_0.a, _obj_0.b, _obj_0[1], _obj_0[2] | ||
2654 | end | ||
2655 | local some_string = "Here is a string\n that has a line break in it." | 2627 | local some_string = "Here is a string\n that has a line break in it." |
2656 | print("I am " .. tostring(math.random() * 100) .. "% sure.") | 2628 | print("I am " .. tostring(math.random() * 100) .. "% sure.") |
2657 | local integer = 1000000 | 2629 | local integer = 1000000 |