diff options
author | Li Jin <dragon-fly@qq.com> | 2024-03-19 02:22:56 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2024-03-19 02:22:56 +0800 |
commit | afc86619d710a578dc3f2bfc2ee1d62913f9abe8 (patch) | |
tree | 726ffe4d33bbaf8be411f73add51a1ffe734bc6f /spec/outputs/5.1/attrib.lua | |
parent | 4f399a181dc773bcc1a86737522915c2c776fb2b (diff) | |
download | yuescript-afc86619d710a578dc3f2bfc2ee1d62913f9abe8.tar.gz yuescript-afc86619d710a578dc3f2bfc2ee1d62913f9abe8.tar.bz2 yuescript-afc86619d710a578dc3f2bfc2ee1d62913f9abe8.zip |
try fixing issue #162.
Diffstat (limited to 'spec/outputs/5.1/attrib.lua')
-rw-r--r-- | spec/outputs/5.1/attrib.lua | 183 |
1 files changed, 103 insertions, 80 deletions
diff --git a/spec/outputs/5.1/attrib.lua b/spec/outputs/5.1/attrib.lua index 70e7e24..e28dca4 100644 --- a/spec/outputs/5.1/attrib.lua +++ b/spec/outputs/5.1/attrib.lua | |||
@@ -50,6 +50,22 @@ do | |||
50 | a, b = _obj_0[1], _obj_0[2] | 50 | a, b = _obj_0[1], _obj_0[2] |
51 | end | 51 | end |
52 | end | 52 | end |
53 | local _anon_func_0 = function(f, error, _close_1, _arg_0, ...) | ||
54 | do | ||
55 | local _ok_0 = _arg_0 | ||
56 | _close_1(f) | ||
57 | if _ok_0 then | ||
58 | return ... | ||
59 | else | ||
60 | return error(...) | ||
61 | end | ||
62 | end | ||
63 | end | ||
64 | local _anon_func_1 = function(io) | ||
65 | local _with_0 = io.open("file.txt") | ||
66 | _with_0:write("Hello") | ||
67 | return _with_0 | ||
68 | end | ||
53 | do | 69 | do |
54 | local v = (function() | 70 | local v = (function() |
55 | if flag then | 71 | if flag then |
@@ -70,23 +86,43 @@ do | |||
70 | return error(...) | 86 | return error(...) |
71 | end | 87 | end |
72 | end)(pcall(function(...) | 88 | end)(pcall(function(...) |
73 | local f = (function() | 89 | local f = _anon_func_1(io) |
74 | local _with_0 = io.open("file.txt") | ||
75 | _with_0:write("Hello") | ||
76 | return _with_0 | ||
77 | end)() | ||
78 | local _close_1 = assert(getmetatable(f).__close) | 90 | local _close_1 = assert(getmetatable(f).__close) |
79 | return (function(_arg_0, ...) | 91 | return _anon_func_0(f, error, _close_1, pcall(function(...) end, ...)) |
80 | local _ok_0 = _arg_0 | ||
81 | _close_1(f) | ||
82 | if _ok_0 then | ||
83 | return ... | ||
84 | else | ||
85 | return error(...) | ||
86 | end | ||
87 | end)(pcall(function(...) end, ...)) | ||
88 | end, ...)) | 92 | end, ...)) |
89 | end | 93 | end |
94 | local _anon_func_2 = function(d, error, _close_1, _arg_0, ...) | ||
95 | do | ||
96 | local _ok_0 = _arg_0 | ||
97 | _close_1(d) | ||
98 | if _ok_0 then | ||
99 | return ... | ||
100 | else | ||
101 | return error(...) | ||
102 | end | ||
103 | end | ||
104 | end | ||
105 | local _anon_func_3 = function(x) | ||
106 | if true then | ||
107 | if "abc" == x then | ||
108 | return 998 | ||
109 | end | ||
110 | end | ||
111 | end | ||
112 | local _anon_func_5 = function(a, b) | ||
113 | if a ~= nil then | ||
114 | return a | ||
115 | else | ||
116 | return b | ||
117 | end | ||
118 | end | ||
119 | local _anon_func_4 = function(a, b) | ||
120 | if _anon_func_5(a, b) then | ||
121 | return { | ||
122 | value = value | ||
123 | } | ||
124 | end | ||
125 | end | ||
90 | do | 126 | do |
91 | local a = (function() | 127 | local a = (function() |
92 | if true then | 128 | if true then |
@@ -110,39 +146,34 @@ do | |||
110 | return error(...) | 146 | return error(...) |
111 | end | 147 | end |
112 | end)(pcall(function(...) | 148 | end)(pcall(function(...) |
113 | local c = (function() | 149 | local c = _anon_func_3(x) |
114 | if true then | 150 | local d = _anon_func_4(a, b) |
115 | local _exp_0 = x | ||
116 | if "abc" == _exp_0 then | ||
117 | return 998 | ||
118 | end | ||
119 | end | ||
120 | end)() | ||
121 | local d = (function() | ||
122 | if (function() | ||
123 | if a ~= nil then | ||
124 | return a | ||
125 | else | ||
126 | return b | ||
127 | end | ||
128 | end)() then | ||
129 | return { | ||
130 | value = value | ||
131 | } | ||
132 | end | ||
133 | end)() | ||
134 | local _close_1 = assert(getmetatable(d).__close) | 151 | local _close_1 = assert(getmetatable(d).__close) |
135 | return (function(_arg_0, ...) | 152 | return _anon_func_2(d, error, _close_1, pcall(function(...) end, ...)) |
136 | local _ok_0 = _arg_0 | ||
137 | _close_1(d) | ||
138 | if _ok_0 then | ||
139 | return ... | ||
140 | else | ||
141 | return error(...) | ||
142 | end | ||
143 | end)(pcall(function(...) end, ...)) | ||
144 | end, ...)) | 153 | end, ...)) |
145 | end | 154 | end |
155 | local _anon_func_6 = function(_, error, _close_1, _arg_0, ...) | ||
156 | do | ||
157 | local _ok_0 = _arg_0 | ||
158 | _close_1(_) | ||
159 | if _ok_0 then | ||
160 | return ... | ||
161 | else | ||
162 | return error(...) | ||
163 | end | ||
164 | end | ||
165 | end | ||
166 | local _anon_func_7 = function(_, _close_2, error, _arg_0, ...) | ||
167 | do | ||
168 | local _ok_0 = _arg_0 | ||
169 | _close_2(_) | ||
170 | if _ok_0 then | ||
171 | return ... | ||
172 | else | ||
173 | return error(...) | ||
174 | end | ||
175 | end | ||
176 | end | ||
146 | do | 177 | do |
147 | local _ = (function() | 178 | local _ = (function() |
148 | local _with_0 = io.open("file.txt") | 179 | local _with_0 = io.open("file.txt") |
@@ -165,30 +196,16 @@ do | |||
165 | end | 196 | end |
166 | }) | 197 | }) |
167 | local _close_1 = assert(getmetatable(_).__close) | 198 | local _close_1 = assert(getmetatable(_).__close) |
168 | return (function(_arg_0, ...) | 199 | return _anon_func_6(_, error, _close_1, pcall(function(...) |
169 | local _ok_0 = _arg_0 | ||
170 | _close_1(_) | ||
171 | if _ok_0 then | ||
172 | return ... | ||
173 | else | ||
174 | return error(...) | ||
175 | end | ||
176 | end)(pcall(function(...) | ||
177 | local _ = setmetatable({ }, { | 200 | local _ = setmetatable({ }, { |
178 | __close = function() | 201 | __close = function() |
179 | return print("first") | 202 | return print("first") |
180 | end | 203 | end |
181 | }) | 204 | }) |
182 | local _close_2 = assert(getmetatable(_).__close) | 205 | local _close_2 = assert(getmetatable(_).__close) |
183 | return (function(_arg_0, ...) | 206 | return _anon_func_7(_, _close_2, error, pcall(function(...) |
184 | local _ok_0 = _arg_0 | 207 | return print("third") |
185 | _close_2(_) | 208 | end, ...)) |
186 | if _ok_0 then | ||
187 | return ... | ||
188 | else | ||
189 | return error(...) | ||
190 | end | ||
191 | end)(pcall(function(...) end, ...)) | ||
192 | end, ...)) | 209 | end, ...)) |
193 | end, ...)) | 210 | end, ...)) |
194 | end | 211 | end |
@@ -203,6 +220,28 @@ def = function(item) | |||
203 | _defers[#_defers + 1] = item | 220 | _defers[#_defers + 1] = item |
204 | return _defers | 221 | return _defers |
205 | end | 222 | end |
223 | local _anon_func_8 = function(_, error, _close_1, _arg_0, ...) | ||
224 | do | ||
225 | local _ok_0 = _arg_0 | ||
226 | _close_1(_) | ||
227 | if _ok_0 then | ||
228 | return ... | ||
229 | else | ||
230 | return error(...) | ||
231 | end | ||
232 | end | ||
233 | end | ||
234 | local _anon_func_9 = function(_, _close_2, error, _arg_0, ...) | ||
235 | do | ||
236 | local _ok_0 = _arg_0 | ||
237 | _close_2(_) | ||
238 | if _ok_0 then | ||
239 | return ... | ||
240 | else | ||
241 | return error(...) | ||
242 | end | ||
243 | end | ||
244 | end | ||
206 | do | 245 | do |
207 | local _ = def(function() | 246 | local _ = def(function() |
208 | return print(3) | 247 | return print(3) |
@@ -221,28 +260,12 @@ do | |||
221 | return print(2) | 260 | return print(2) |
222 | end) | 261 | end) |
223 | local _close_1 = assert(getmetatable(_).__close) | 262 | local _close_1 = assert(getmetatable(_).__close) |
224 | return (function(_arg_0, ...) | 263 | return _anon_func_8(_, error, _close_1, pcall(function(...) |
225 | local _ok_0 = _arg_0 | ||
226 | _close_1(_) | ||
227 | if _ok_0 then | ||
228 | return ... | ||
229 | else | ||
230 | return error(...) | ||
231 | end | ||
232 | end)(pcall(function(...) | ||
233 | local _ = def(function() | 264 | local _ = def(function() |
234 | return print(1) | 265 | return print(1) |
235 | end) | 266 | end) |
236 | local _close_2 = assert(getmetatable(_).__close) | 267 | local _close_2 = assert(getmetatable(_).__close) |
237 | return (function(_arg_0, ...) | 268 | return _anon_func_9(_, _close_2, error, pcall(function(...) end, ...)) |
238 | local _ok_0 = _arg_0 | ||
239 | _close_2(_) | ||
240 | if _ok_0 then | ||
241 | return ... | ||
242 | else | ||
243 | return error(...) | ||
244 | end | ||
245 | end)(pcall(function(...) end, ...)) | ||
246 | end, ...)) | 269 | end, ...)) |
247 | end, ...)) | 270 | end, ...)) |
248 | end | 271 | end |