Skip to content

Commit

Permalink
remove one more redundant 'do' block from destructuring.
Browse files Browse the repository at this point in the history
  • Loading branch information
pigpigyyy committed Mar 25, 2024
1 parent 4e3656d commit 21004f1
Show file tree
Hide file tree
Showing 20 changed files with 320 additions and 500 deletions.
12 changes: 5 additions & 7 deletions spec/outputs/5.1/attrib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,11 @@ do
end
do
local a, b
do
local _obj_0 = {
2,
3
}
a, b = _obj_0[1], _obj_0[2]
end
local _obj_0 = {
2,
3
}
a, b = _obj_0[1], _obj_0[2]
end
local _anon_func_0 = function(_close_1, error, f, _arg_0, ...)
do
Expand Down
12 changes: 4 additions & 8 deletions spec/outputs/assign.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,11 @@ return _(function()
do
local a, b
if "a" == c then
do
local _obj_0 = tb
a, b = _obj_0[1], _obj_0[2]
end
local _obj_0 = tb
a, b = _obj_0[1], _obj_0[2]
elseif "b" == c then
do
local _obj_0 = f()
a, b = _obj_0[1], _obj_0[2]
end
local _obj_0 = f()
a, b = _obj_0[1], _obj_0[2]
end
end
if x then
Expand Down
12 changes: 5 additions & 7 deletions spec/outputs/attrib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@ do
end
do
local a, b
do
local _obj_0 = {
2,
3
}
a, b = _obj_0[1], _obj_0[2]
end
local _obj_0 = {
2,
3
}
a, b = _obj_0[1], _obj_0[2]
end
do
local v <close> = (function()
Expand Down
14 changes: 6 additions & 8 deletions spec/outputs/backcall.lua
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,13 @@ end
do
local result, msg
do
do
local _obj_0 = receiveAsync("filename.txt", function(data)
print(data)
return processAsync(data, function(info)
return check(info)
end)
local _obj_0 = receiveAsync("filename.txt", function(data)
print(data)
return processAsync(data, function(info)
return check(info)
end)
result, msg = _obj_0.result, _obj_0.msg
end
end)
result, msg = _obj_0.result, _obj_0.msg
end
print(result, msg)
local totalSize = reduce(((function()
Expand Down
104 changes: 38 additions & 66 deletions spec/outputs/codes_from_doc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,8 @@ do
C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt
end
local one, two, ch
do
local _obj_0 = require("export")
one, two, ch = _obj_0[1], _obj_0[2], _obj_0.Something.umm[1]
end
local _obj_0 = require("export")
one, two, ch = _obj_0[1], _obj_0[2], _obj_0.Something.umm[1]
end
local _module_0 = { }
local a, b, c = 1, 2, 3
Expand Down Expand Up @@ -527,36 +525,26 @@ local obj2 = {
local first, second = obj2.numbers[1], obj2.numbers[2]
print(first, second, color)
local first, second, color
do
local _obj_0 = obj2
first, second, color = _obj_0.numbers[1], _obj_0.numbers[2], _obj_0.properties.color
end
local _obj_0 = obj2
first, second, color = _obj_0.numbers[1], _obj_0.numbers[2], _obj_0.properties.color
local concat, insert
do
local _obj_0 = table
concat, insert = _obj_0.concat, _obj_0.insert
end
local _obj_0 = table
concat, insert = _obj_0.concat, _obj_0.insert
local mix, max, rand
do
local _obj_0 = math
mix, max, rand = _obj_0.mix, _obj_0.max, _obj_0.random
end
local _obj_0 = math
mix, max, rand = _obj_0.mix, _obj_0.max, _obj_0.random
local name, job
do
local _obj_0 = person
name, job = _obj_0.name, _obj_0.job
if name == nil then
name = "nameless"
end
if job == nil then
job = "jobless"
end
local _obj_0 = person
name, job = _obj_0.name, _obj_0.job
if name == nil then
name = "nameless"
end
local two, four
do
local _obj_0 = items
two, four = _obj_0[2], _obj_0[4]
if job == nil then
job = "jobless"
end
local two, four
local _obj_0 = items
two, four = _obj_0[2], _obj_0[4]
local tuples = {
{
"hello",
Expand Down Expand Up @@ -647,10 +635,8 @@ local _ <close> = setmetatable({ }, {
end
})
local a, b, c, d
do
local _obj_0 = tb
a, b, c, d = _obj_0.a, _obj_0.b, _obj_0[1], _obj_0[2]
end
local _obj_0 = tb
a, b, c, d = _obj_0.a, _obj_0.b, _obj_0[1], _obj_0[2]
local some_string = "Here is a string\n that has a line break in it."
print("I am " .. tostring(math.random() * 100) .. "% sure.")
local integer = 1000000
Expand Down Expand Up @@ -2360,10 +2346,8 @@ do
C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt
end
local one, two, ch
do
local _obj_0 = require("export")
one, two, ch = _obj_0[1], _obj_0[2], _obj_0.Something.umm[1]
end
local _obj_0 = require("export")
one, two, ch = _obj_0[1], _obj_0[2], _obj_0.Something.umm[1]
end
local _module_0 = { }
local a, b, c = 1, 2, 3
Expand Down Expand Up @@ -2528,36 +2512,26 @@ local obj2 = {
local first, second = obj2.numbers[1], obj2.numbers[2]
print(first, second, color)
local first, second, color
do
local _obj_0 = obj2
first, second, color = _obj_0.numbers[1], _obj_0.numbers[2], _obj_0.properties.color
end
local _obj_0 = obj2
first, second, color = _obj_0.numbers[1], _obj_0.numbers[2], _obj_0.properties.color
local concat, insert
do
local _obj_0 = table
concat, insert = _obj_0.concat, _obj_0.insert
end
local _obj_0 = table
concat, insert = _obj_0.concat, _obj_0.insert
local mix, max, rand
do
local _obj_0 = math
mix, max, rand = _obj_0.mix, _obj_0.max, _obj_0.random
end
local _obj_0 = math
mix, max, rand = _obj_0.mix, _obj_0.max, _obj_0.random
local name, job
do
local _obj_0 = person
name, job = _obj_0.name, _obj_0.job
if name == nil then
name = "nameless"
end
if job == nil then
job = "jobless"
end
local _obj_0 = person
name, job = _obj_0.name, _obj_0.job
if name == nil then
name = "nameless"
end
local two, four
do
local _obj_0 = items
two, four = _obj_0[2], _obj_0[4]
if job == nil then
job = "jobless"
end
local two, four
local _obj_0 = items
two, four = _obj_0[2], _obj_0[4]
local tuples = {
{
"hello",
Expand Down Expand Up @@ -2648,10 +2622,8 @@ local _ <close> = setmetatable({ }, {
end
})
local a, b, c, d
do
local _obj_0 = tb
a, b, c, d = _obj_0.a, _obj_0.b, _obj_0[1], _obj_0[2]
end
local _obj_0 = tb
a, b, c, d = _obj_0.a, _obj_0.b, _obj_0[1], _obj_0[2]
local some_string = "Here is a string\n that has a line break in it."
print("I am " .. tostring(math.random() * 100) .. "% sure.")
local integer = 1000000
Expand Down
104 changes: 38 additions & 66 deletions spec/outputs/codes_from_doc_zh.lua
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,8 @@ do
C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt
end
local one, two, ch
do
local _obj_0 = require("export")
one, two, ch = _obj_0[1], _obj_0[2], _obj_0.Something.umm[1]
end
local _obj_0 = require("export")
one, two, ch = _obj_0[1], _obj_0[2], _obj_0.Something.umm[1]
end
local _module_0 = { }
local a, b, c = 1, 2, 3
Expand Down Expand Up @@ -527,36 +525,26 @@ local obj2 = {
local first, second = obj2.numbers[1], obj2.numbers[2]
print(first, second, color)
local first, second, color
do
local _obj_0 = obj2
first, second, color = _obj_0.numbers[1], _obj_0.numbers[2], _obj_0.properties.color
end
local _obj_0 = obj2
first, second, color = _obj_0.numbers[1], _obj_0.numbers[2], _obj_0.properties.color
local concat, insert
do
local _obj_0 = table
concat, insert = _obj_0.concat, _obj_0.insert
end
local _obj_0 = table
concat, insert = _obj_0.concat, _obj_0.insert
local mix, max, rand
do
local _obj_0 = math
mix, max, rand = _obj_0.mix, _obj_0.max, _obj_0.random
end
local _obj_0 = math
mix, max, rand = _obj_0.mix, _obj_0.max, _obj_0.random
local name, job
do
local _obj_0 = person
name, job = _obj_0.name, _obj_0.job
if name == nil then
name = "nameless"
end
if job == nil then
job = "jobless"
end
local _obj_0 = person
name, job = _obj_0.name, _obj_0.job
if name == nil then
name = "nameless"
end
local two, four
do
local _obj_0 = items
two, four = _obj_0[2], _obj_0[4]
if job == nil then
job = "jobless"
end
local two, four
local _obj_0 = items
two, four = _obj_0[2], _obj_0[4]
local tuples = {
{
"hello",
Expand Down Expand Up @@ -647,10 +635,8 @@ local _ <close> = setmetatable({ }, {
end
})
local a, b, c, d
do
local _obj_0 = tb
a, b, c, d = _obj_0.a, _obj_0.b, _obj_0[1], _obj_0[2]
end
local _obj_0 = tb
a, b, c, d = _obj_0.a, _obj_0.b, _obj_0[1], _obj_0[2]
local some_string = "这是一个字符串\n 并包括一个换行。"
print("我有" .. tostring(math.random() * 100) .. "%的把握。")
local integer = 1000000
Expand Down Expand Up @@ -2354,10 +2340,8 @@ do
C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt
end
local one, two, ch
do
local _obj_0 = require("export")
one, two, ch = _obj_0[1], _obj_0[2], _obj_0.Something.umm[1]
end
local _obj_0 = require("export")
one, two, ch = _obj_0[1], _obj_0[2], _obj_0.Something.umm[1]
end
local _module_0 = { }
local a, b, c = 1, 2, 3
Expand Down Expand Up @@ -2522,36 +2506,26 @@ local obj2 = {
local first, second = obj2.numbers[1], obj2.numbers[2]
print(first, second, color)
local first, second, color
do
local _obj_0 = obj2
first, second, color = _obj_0.numbers[1], _obj_0.numbers[2], _obj_0.properties.color
end
local _obj_0 = obj2
first, second, color = _obj_0.numbers[1], _obj_0.numbers[2], _obj_0.properties.color
local concat, insert
do
local _obj_0 = table
concat, insert = _obj_0.concat, _obj_0.insert
end
local _obj_0 = table
concat, insert = _obj_0.concat, _obj_0.insert
local mix, max, rand
do
local _obj_0 = math
mix, max, rand = _obj_0.mix, _obj_0.max, _obj_0.random
end
local _obj_0 = math
mix, max, rand = _obj_0.mix, _obj_0.max, _obj_0.random
local name, job
do
local _obj_0 = person
name, job = _obj_0.name, _obj_0.job
if name == nil then
name = "nameless"
end
if job == nil then
job = "jobless"
end
local _obj_0 = person
name, job = _obj_0.name, _obj_0.job
if name == nil then
name = "nameless"
end
local two, four
do
local _obj_0 = items
two, four = _obj_0[2], _obj_0[4]
if job == nil then
job = "jobless"
end
local two, four
local _obj_0 = items
two, four = _obj_0[2], _obj_0[4]
local tuples = {
{
"hello",
Expand Down Expand Up @@ -2642,10 +2616,8 @@ local _ <close> = setmetatable({ }, {
end
})
local a, b, c, d
do
local _obj_0 = tb
a, b, c, d = _obj_0.a, _obj_0.b, _obj_0[1], _obj_0[2]
end
local _obj_0 = tb
a, b, c, d = _obj_0.a, _obj_0.b, _obj_0[1], _obj_0[2]
local some_string = "这是一个字符串\n 并包括一个换行。"
print("我有" .. tostring(math.random() * 100) .. "%的把握。")
local integer = 1000000
Expand Down
Loading

0 comments on commit 21004f1

Please sign in to comment.