aboutsummaryrefslogtreecommitdiff
path: root/spec/outputs/codes_from_doc.lua
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2024-03-25 08:25:06 +0800
committerLi Jin <dragon-fly@qq.com>2024-03-25 08:25:06 +0800
commit21004f1fb9b2f6129a231a6c8d99179f0d6e3edf (patch)
treed94c69b9758e0e8ff38dc5f23bc888d084846110 /spec/outputs/codes_from_doc.lua
parent4e3656da3711fd045fdf90dec7084bd4556c5b7f (diff)
downloadyuescript-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.lua104
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
366end 364end
367local _module_0 = { } 365local _module_0 = { }
368local a, b, c = 1, 2, 3 366local a, b, c = 1, 2, 3
@@ -527,36 +525,26 @@ local obj2 = {
527local first, second = obj2.numbers[1], obj2.numbers[2] 525local first, second = obj2.numbers[1], obj2.numbers[2]
528print(first, second, color) 526print(first, second, color)
529local first, second, color 527local first, second, color
530do 528local _obj_0 = obj2
531 local _obj_0 = obj2 529first, 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
533end
534local concat, insert 530local concat, insert
535do 531local _obj_0 = table
536 local _obj_0 = table 532concat, insert = _obj_0.concat, _obj_0.insert
537 concat, insert = _obj_0.concat, _obj_0.insert
538end
539local mix, max, rand 533local mix, max, rand
540do 534local _obj_0 = math
541 local _obj_0 = math 535mix, max, rand = _obj_0.mix, _obj_0.max, _obj_0.random
542 mix, max, rand = _obj_0.mix, _obj_0.max, _obj_0.random
543end
544local name, job 536local name, job
545do 537local _obj_0 = person
546 local _obj_0 = person 538name, job = _obj_0.name, _obj_0.job
547 name, job = _obj_0.name, _obj_0.job 539if 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
554end 541end
555local two, four 542if job == nil then
556do 543 job = "jobless"
557 local _obj_0 = items
558 two, four = _obj_0[2], _obj_0[4]
559end 544end
545local two, four
546local _obj_0 = items
547two, four = _obj_0[2], _obj_0[4]
560local tuples = { 548local tuples = {
561 { 549 {
562 "hello", 550 "hello",
@@ -647,10 +635,8 @@ local _ <close> = setmetatable({ }, {
647 end 635 end
648}) 636})
649local a, b, c, d 637local a, b, c, d
650do 638local _obj_0 = tb
651 local _obj_0 = tb 639a, 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]
653end
654local some_string = "Here is a string\n that has a line break in it." 640local some_string = "Here is a string\n that has a line break in it."
655print("I am " .. tostring(math.random() * 100) .. "% sure.") 641print("I am " .. tostring(math.random() * 100) .. "% sure.")
656local integer = 1000000 642local 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
2367end 2351end
2368local _module_0 = { } 2352local _module_0 = { }
2369local a, b, c = 1, 2, 3 2353local a, b, c = 1, 2, 3
@@ -2528,36 +2512,26 @@ local obj2 = {
2528local first, second = obj2.numbers[1], obj2.numbers[2] 2512local first, second = obj2.numbers[1], obj2.numbers[2]
2529print(first, second, color) 2513print(first, second, color)
2530local first, second, color 2514local first, second, color
2531do 2515local _obj_0 = obj2
2532 local _obj_0 = obj2 2516first, 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
2534end
2535local concat, insert 2517local concat, insert
2536do 2518local _obj_0 = table
2537 local _obj_0 = table 2519concat, insert = _obj_0.concat, _obj_0.insert
2538 concat, insert = _obj_0.concat, _obj_0.insert
2539end
2540local mix, max, rand 2520local mix, max, rand
2541do 2521local _obj_0 = math
2542 local _obj_0 = math 2522mix, max, rand = _obj_0.mix, _obj_0.max, _obj_0.random
2543 mix, max, rand = _obj_0.mix, _obj_0.max, _obj_0.random
2544end
2545local name, job 2523local name, job
2546do 2524local _obj_0 = person
2547 local _obj_0 = person 2525name, job = _obj_0.name, _obj_0.job
2548 name, job = _obj_0.name, _obj_0.job 2526if 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
2555end 2528end
2556local two, four 2529if job == nil then
2557do 2530 job = "jobless"
2558 local _obj_0 = items
2559 two, four = _obj_0[2], _obj_0[4]
2560end 2531end
2532local two, four
2533local _obj_0 = items
2534two, four = _obj_0[2], _obj_0[4]
2561local tuples = { 2535local tuples = {
2562 { 2536 {
2563 "hello", 2537 "hello",
@@ -2648,10 +2622,8 @@ local _ <close> = setmetatable({ }, {
2648 end 2622 end
2649}) 2623})
2650local a, b, c, d 2624local a, b, c, d
2651do 2625local _obj_0 = tb
2652 local _obj_0 = tb 2626a, 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]
2654end
2655local some_string = "Here is a string\n that has a line break in it." 2627local some_string = "Here is a string\n that has a line break in it."
2656print("I am " .. tostring(math.random() * 100) .. "% sure.") 2628print("I am " .. tostring(math.random() * 100) .. "% sure.")
2657local integer = 1000000 2629local integer = 1000000