Skip to content

Commit

Permalink
try fixing issue #162.
Browse files Browse the repository at this point in the history
  • Loading branch information
pigpigyyy committed Mar 18, 2024
1 parent 4f399a1 commit afc8661
Show file tree
Hide file tree
Showing 15 changed files with 1,328 additions and 819 deletions.
2 changes: 2 additions & 0 deletions spec/inputs/attrib.yue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ do

close _ = <close>: -> print "first"

print "third"

_defers = setmetatable {}, __close: =>
@[#@]!
@[#@] = nil
Expand Down
6 changes: 4 additions & 2 deletions spec/inputs/unicode/multiline_chain.yue
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@

表bb =
键1: 变量a
\变量b 123
.变量c!
\变量b 123,
:字段A
.变量c 1, 2, 3
:字段B
键2:
键w1: 变量a!
.变量b
Expand Down
183 changes: 103 additions & 80 deletions spec/outputs/5.1/attrib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,22 @@ do
a, b = _obj_0[1], _obj_0[2]
end
end
local _anon_func_0 = function(f, error, _close_1, _arg_0, ...)
do
local _ok_0 = _arg_0
_close_1(f)
if _ok_0 then
return ...
else
return error(...)
end
end
end
local _anon_func_1 = function(io)
local _with_0 = io.open("file.txt")
_with_0:write("Hello")
return _with_0
end
do
local v = (function()
if flag then
Expand All @@ -70,23 +86,43 @@ do
return error(...)
end
end)(pcall(function(...)
local f = (function()
local _with_0 = io.open("file.txt")
_with_0:write("Hello")
return _with_0
end)()
local f = _anon_func_1(io)
local _close_1 = assert(getmetatable(f).__close)
return (function(_arg_0, ...)
local _ok_0 = _arg_0
_close_1(f)
if _ok_0 then
return ...
else
return error(...)
end
end)(pcall(function(...) end, ...))
return _anon_func_0(f, error, _close_1, pcall(function(...) end, ...))
end, ...))
end
local _anon_func_2 = function(d, error, _close_1, _arg_0, ...)
do
local _ok_0 = _arg_0
_close_1(d)
if _ok_0 then
return ...
else
return error(...)
end
end
end
local _anon_func_3 = function(x)
if true then
if "abc" == x then
return 998
end
end
end
local _anon_func_5 = function(a, b)
if a ~= nil then
return a
else
return b
end
end
local _anon_func_4 = function(a, b)
if _anon_func_5(a, b) then
return {
value = value
}
end
end
do
local a = (function()
if true then
Expand All @@ -110,39 +146,34 @@ do
return error(...)
end
end)(pcall(function(...)
local c = (function()
if true then
local _exp_0 = x
if "abc" == _exp_0 then
return 998
end
end
end)()
local d = (function()
if (function()
if a ~= nil then
return a
else
return b
end
end)() then
return {
value = value
}
end
end)()
local c = _anon_func_3(x)
local d = _anon_func_4(a, b)
local _close_1 = assert(getmetatable(d).__close)
return (function(_arg_0, ...)
local _ok_0 = _arg_0
_close_1(d)
if _ok_0 then
return ...
else
return error(...)
end
end)(pcall(function(...) end, ...))
return _anon_func_2(d, error, _close_1, pcall(function(...) end, ...))
end, ...))
end
local _anon_func_6 = function(_, error, _close_1, _arg_0, ...)
do
local _ok_0 = _arg_0
_close_1(_)
if _ok_0 then
return ...
else
return error(...)
end
end
end
local _anon_func_7 = function(_, _close_2, error, _arg_0, ...)
do
local _ok_0 = _arg_0
_close_2(_)
if _ok_0 then
return ...
else
return error(...)
end
end
end
do
local _ = (function()
local _with_0 = io.open("file.txt")
Expand All @@ -165,30 +196,16 @@ do
end
})
local _close_1 = assert(getmetatable(_).__close)
return (function(_arg_0, ...)
local _ok_0 = _arg_0
_close_1(_)
if _ok_0 then
return ...
else
return error(...)
end
end)(pcall(function(...)
return _anon_func_6(_, error, _close_1, pcall(function(...)
local _ = setmetatable({ }, {
__close = function()
return print("first")
end
})
local _close_2 = assert(getmetatable(_).__close)
return (function(_arg_0, ...)
local _ok_0 = _arg_0
_close_2(_)
if _ok_0 then
return ...
else
return error(...)
end
end)(pcall(function(...) end, ...))
return _anon_func_7(_, _close_2, error, pcall(function(...)
return print("third")
end, ...))
end, ...))
end, ...))
end
Expand All @@ -203,6 +220,28 @@ def = function(item)
_defers[#_defers + 1] = item
return _defers
end
local _anon_func_8 = function(_, error, _close_1, _arg_0, ...)
do
local _ok_0 = _arg_0
_close_1(_)
if _ok_0 then
return ...
else
return error(...)
end
end
end
local _anon_func_9 = function(_, _close_2, error, _arg_0, ...)
do
local _ok_0 = _arg_0
_close_2(_)
if _ok_0 then
return ...
else
return error(...)
end
end
end
do
local _ = def(function()
return print(3)
Expand All @@ -221,28 +260,12 @@ do
return print(2)
end)
local _close_1 = assert(getmetatable(_).__close)
return (function(_arg_0, ...)
local _ok_0 = _arg_0
_close_1(_)
if _ok_0 then
return ...
else
return error(...)
end
end)(pcall(function(...)
return _anon_func_8(_, error, _close_1, pcall(function(...)
local _ = def(function()
return print(1)
end)
local _close_2 = assert(getmetatable(_).__close)
return (function(_arg_0, ...)
local _ok_0 = _arg_0
_close_2(_)
if _ok_0 then
return ...
else
return error(...)
end
end)(pcall(function(...) end, ...))
return _anon_func_9(_, _close_2, error, pcall(function(...) end, ...))
end, ...))
end, ...))
end
9 changes: 6 additions & 3 deletions spec/outputs/assign.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,14 @@ do
end
end
end
return _(function()
setmetatable(a, (function()
local _anon_func_0 = function(print)
do
print(123)
return { }
end)())
end
end
return _(function()
setmetatable(a, _anon_func_0(print))
do
local a, b
if "a" == c then
Expand Down
1 change: 1 addition & 0 deletions spec/outputs/attrib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ do
return print("first")
end
})
print("third")
end
local _defers = setmetatable({ }, {
__close = function(self)
Expand Down
9 changes: 6 additions & 3 deletions spec/outputs/unicode/assign.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,14 @@ do
end
end
end
return __u65e0_u6548_u53d8_u91cf(function()
setmetatable(a_u53d8_u91cf, (function()
local _anon_func_0 = function(_u6253_u5370)
do
_u6253_u5370(123)
return { }
end)())
end
end
return __u65e0_u6548_u53d8_u91cf(function()
setmetatable(a_u53d8_u91cf, _anon_func_0(_u6253_u5370))
do
local _u5143_u7d20a, _u5143_u7d20b
do
Expand Down
26 changes: 13 additions & 13 deletions spec/outputs/unicode/macro.lua
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,11 @@ local _call_1 = (_({
-2,
3
}))
_call_1 = _call_1[""](_call_1, _call_1, _call_1, _call_1, _call_1, _call_1, _call_1, _call_1)
_call_1 = _call_1["映射"](_call_1, _call_1, _call_1, _call_1, function(self)
_call_1 = _call_1[""](_call_1)
_call_1 = _call_1["映射"](_call_1, function(self)
return self * 2
end)
_call_1 = _call_1["过滤"](_call_1, _call_1, function(self)
_call_1 = _call_1["过滤"](_call_1, function(self)
return self > 3
end)
local _u7ed3_u679ca = _call_1["取值"](_call_1)
Expand All @@ -227,25 +227,25 @@ local _call_2 = (_({
-2,
3
}))
_call_2 = _call_2[""](_call_2, _call_2, _call_2, _call_2, _call_2, _call_2, _call_2, _call_2)
_call_2 = _call_2["映射"](_call_2, _call_2, _call_2, _call_2, function(self)
_call_2 = _call_2[""](_call_2)
_call_2 = _call_2["映射"](_call_2, function(self)
return self * 2
end)
_call_2 = _call_2["过滤"](_call_2, _call_2, function(self)
_call_2 = _call_2["过滤"](_call_2, function(self)
return self > 3
end)
_call_2["每一个"](_call_2, function(self)
return _u6253_u5370(self)
end)
local _call_3 = _u539f_u70b9["变换"]["根节点"]["游戏对象"]
_call_3 = _call_3["父节点"](_call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3)
_call_3 = _call_3["后代"](_call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3)
_call_3 = _call_3["选择启用"](_call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3)
_call_3 = _call_3["选择可见"](_call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3, _call_3)
_call_3 = _call_3["标签等于"](_call_3, _call_3, _call_3, _call_3, "fx")
_call_3 = _call_3["其中"](_call_3, _call_3, function(x)
_call_3 = _call_3["父节点"](_call_3)
_call_3 = _call_3["后代"](_call_3)
_call_3 = _call_3["选择启用"](_call_3)
_call_3 = _call_3["选择可见"](_call_3)
_call_3 = _call_3["标签等于"](_call_3, "fx")
_call_3 = _call_3["其中"](_call_3, function(x)
local _call_4 = x["名称"]
return _call_4["结尾为"](_call_4, _call_4, "(克隆)")
return _call_4["结尾为"](_call_4, "(克隆)")
end)
_u7ed3_u679c = _call_3["摧毁"](_call_3)
do
Expand Down
Loading

0 comments on commit afc8661

Please sign in to comment.