aboutsummaryrefslogtreecommitdiff
path: root/spec/outputs/attrib.lua
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2024-05-23 16:30:05 +0800
committerLi Jin <dragon-fly@qq.com>2024-05-23 16:30:05 +0800
commit1890294226034d27165af016c8c93a484d978b49 (patch)
tree97f7f698aef1998ceb037080bd9f46b6f894e441 /spec/outputs/attrib.lua
parent06bf167924d04aaefe80d6e4ead40989a447ea34 (diff)
downloadyuescript-1890294226034d27165af016c8c93a484d978b49.tar.gz
yuescript-1890294226034d27165af016c8c93a484d978b49.tar.bz2
yuescript-1890294226034d27165af016c8c93a484d978b49.zip
prevent more anonymous functions generating from `const`, `close` decl.
Diffstat (limited to 'spec/outputs/attrib.lua')
-rw-r--r--spec/outputs/attrib.lua94
1 files changed, 47 insertions, 47 deletions
diff --git a/spec/outputs/attrib.lua b/spec/outputs/attrib.lua
index 626944e..e48963c 100644
--- a/spec/outputs/attrib.lua
+++ b/spec/outputs/attrib.lua
@@ -34,62 +34,62 @@ do
34 a, b = _obj_0[1], _obj_0[2] 34 a, b = _obj_0[1], _obj_0[2]
35end 35end
36do 36do
37 local v <close> = (function() 37 local v
38 if flag then 38 if flag then
39 return func() 39 v = func()
40 else 40 else
41 return setmetatable({ }, { 41 v = setmetatable({ }, {
42 __close = function(self) end 42 __close = function(self) end
43 }) 43 })
44 end 44 end
45 end)() 45 local _close_0 <close> = v
46 local f <close> = (function() 46 local f
47 local _with_0 = io.open("file.txt") 47 local _with_0 = io.open("file.txt")
48 _with_0:write("Hello") 48 _with_0:write("Hello")
49 return _with_0 49 f = _with_0
50 end)() 50 local _close_1 <close> = f
51end 51end
52do 52do
53 local a <const> = (function() 53 local a
54 if true then 54 if true then
55 return 1 55 a = 1
56 end 56 end
57 end)() 57 local b
58 local b <close> = (function() 58 if not false then
59 if not false then 59 if x then
60 if x then 60 b = 1
61 return 1
62 end
63 end 61 end
64 end)() 62 end
65 local c <const> = (function() 63 local _close_0 <close> = b
66 if true then 64 local c
67 local _exp_0 = x 65 if true then
68 if "abc" == _exp_0 then 66 local _exp_0 = x
69 return 998 67 if "abc" == _exp_0 then
70 end 68 c = 998
71 end 69 end
72 end)() 70 end
73 local d <close> = (function() 71 local d
74 if (function() 72 if (function()
75 if a ~= nil then 73 if a ~= nil then
76 return a 74 return a
77 else 75 else
78 return b 76 return b
79 end
80 end)() then
81 return {
82 value = value
83 }
84 end 77 end
85 end)() 78 end)() then
79 d = {
80 value = value
81 }
82 end
83 local _close_1 <close> = d
86end 84end
87do 85do
88 local _ <close> = (function() 86 local _
87 do
89 local _with_0 = io.open("file.txt") 88 local _with_0 = io.open("file.txt")
90 _with_0:write("Hello") 89 _with_0:write("Hello")
91 return _with_0 90 _ = _with_0
92 end)() 91 end
92 local _close_0 <close> = _
93 local _ <close> = setmetatable({ }, { 93 local _ <close> = setmetatable({ }, {
94 __close = function() 94 __close = function()
95 return print("second") 95 return print("second")