aboutsummaryrefslogtreecommitdiff
path: root/spec/outputs/5.1/attrib.lua
blob: 0edaf0e44879fd69524358d5d4ae44b98ccaef9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
local a, b, c, d = 1, 2, 3, 4
do
	local a, b = setmetatable({ }, {
		__close = function(self)
			return print("closed")
		end
	})
	local _close_0 = assert(getmetatable(a).__close)
	local _close_1 = assert(getmetatable(b).__close);
	(function(_arg_0, ...)
		local _ok_0 = _arg_0
		_close_1(b)
		_close_0(a)
		if _ok_0 then
			return ...
		else
			return error(...)
		end
	end)(pcall(function()
		local c, d = 123, 'abc'
		close(a, b)
		return const(c, d)
	end))
end
do
	local a = f()
	local b, c, d
	local _obj_0, _obj_1 = f1()
	b, c = _obj_0[1], _obj_0[2]
	d = _obj_1[1]
end
do
	local a, b, c, d
	local _obj_0, _obj_1, _obj_2 = f()
	a = _obj_0
	b, c = _obj_1[1], _obj_1[2]
	d = _obj_2[1]
end
do
	local a, b
	do
		local _obj_0 = {
			2,
			3
		}
		a, b = _obj_0[1], _obj_0[2]
	end
end
local _anon_func_0 = function(_close_1, error, f, _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
local _anon_func_2 = function() end
do
	local v = (function()
		if flag then
			return func()
		else
			return setmetatable({ }, {
				__close = function(self) end
			})
		end
	end)()
	local _close_0 = assert(getmetatable(v).__close);
	(function(_arg_0, ...)
		local _ok_0 = _arg_0
		_close_0(v)
		if _ok_0 then
			return ...
		else
			return error(...)
		end
	end)(pcall(function()
		local f = _anon_func_1(io)
		local _close_1 = assert(getmetatable(f).__close)
		return _anon_func_0(_close_1, error, f, pcall(_anon_func_2))
	end))
end
local _anon_func_3 = function(_close_1, d, error, _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_4 = function(x)
	if true then
		if "abc" == x then
			return 998
		end
	end
end
local _anon_func_6 = function(a, b)
	if a ~= nil then
		return a
	else
		return b
	end
end
local _anon_func_5 = function(a, b)
	if _anon_func_6(a, b) then
		return {
			value = value
		}
	end
end
local _anon_func_7 = function() end
do
	local a = (function()
		if true then
			return 1
		end
	end)()
	local b = (function()
		if not false then
			if x then
				return 1
			end
		end
	end)()
	local _close_0 = assert(getmetatable(b).__close);
	(function(_arg_0, ...)
		local _ok_0 = _arg_0
		_close_0(b)
		if _ok_0 then
			return ...
		else
			return error(...)
		end
	end)(pcall(function()
		local c = _anon_func_4(x)
		local d = _anon_func_5(a, b)
		local _close_1 = assert(getmetatable(d).__close)
		return _anon_func_3(_close_1, d, error, pcall(_anon_func_7))
	end))
end
local _anon_func_8 = function(_, _close_1, error, _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 _ = (function()
		local _with_0 = io.open("file.txt")
		_with_0:write("Hello")
		return _with_0
	end)()
	local _close_0 = assert(getmetatable(_).__close);
	(function(_arg_0, ...)
		local _ok_0 = _arg_0
		_close_0(_)
		if _ok_0 then
			return ...
		else
			return error(...)
		end
	end)(pcall(function()
		local _ = setmetatable({ }, {
			__close = function()
				return print("second")
			end
		})
		local _close_1 = assert(getmetatable(_).__close)
		return _anon_func_8(_, _close_1, error, pcall(function()
			local _ = setmetatable({ }, {
				__close = function()
					return print("first")
				end
			})
			local _close_2 = assert(getmetatable(_).__close)
			return _anon_func_9(_, _close_2, error, pcall(print, "third"))
		end))
	end))
end
local _defers = setmetatable({ }, {
	__close = function(self)
		self[#self]()
		self[#self] = nil
	end
})
local def
def = function(item)
	_defers[#_defers + 1] = item
	return _defers
end
local _anon_func_10 = function(_, _close_1, error, _arg_0, ...)
	do
		local _ok_0 = _arg_0
		_close_1(_)
		if _ok_0 then
			return ...
		else
			return error(...)
		end
	end
end
local _anon_func_11 = 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
local _anon_func_12 = function() end
do
	local _ = def(function()
		return print(3)
	end)
	local _close_0 = assert(getmetatable(_).__close)
	return (function(_arg_0, ...)
		local _ok_0 = _arg_0
		_close_0(_)
		if _ok_0 then
			return ...
		else
			return error(...)
		end
	end)(pcall(function()
		local _ = def(function()
			return print(2)
		end)
		local _close_1 = assert(getmetatable(_).__close)
		return _anon_func_10(_, _close_1, error, pcall(function()
			local _ = def(function()
				return print(1)
			end)
			local _close_2 = assert(getmetatable(_).__close)
			return _anon_func_11(_, _close_2, error, pcall(_anon_func_12))
		end))
	end))
end