aboutsummaryrefslogtreecommitdiff
path: root/spec/outputs/5.1/attrib.lua
blob: f782b45a8b1f2d8b5e39189a6c6496660aaf1cff (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
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
	do
		local _obj_0, _obj_1 = f1()
		b, c = _obj_0[1], _obj_0[2]
		d = _obj_1[1]
	end
end
do
	local a, b, c, d
	do
		local _obj_0, _obj_1, _obj_2 = f()
		a = _obj_0
		b, c = _obj_1[1], _obj_1[2]
		d = _obj_2[1]
	end
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 = (function()
			local _with_0 = io.open("file.txt")
			_with_0:write("Hello")
			return _with_0
		end)()
		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, ...))
	end, ...))
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 = (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 _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, ...))
	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 (function(_arg_0, ...)
			local _ok_0 = _arg_0
			_close_1(_)
			if _ok_0 then
				return ...
			else
				return error(...)
			end
		end)(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, ...))
		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
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 (function(_arg_0, ...)
			local _ok_0 = _arg_0
			_close_1(_)
			if _ok_0 then
				return ...
			else
				return error(...)
			end
		end)(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, ...))
		end, ...))
	end, ...))
end