summaryrefslogtreecommitdiff
path: root/spec/outputs/attrib.lua
blob: d9ac3f28fa9ea38c00853f3d1edfe0d20368ff99 (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
do
	local a <close>, b <close> = setmetatable({ }, {
		__close = function(self)
			return print("closed")
		end
	})
	local c <const>, d <const> = 123, 'abc'
	close(a, b)
	const(c, d)
end
do
	local v <close> = (function()
		if flag then
			return func()
		else
			return setmetatable({ }, {
				__close = function(self) end
			})
		end
	end)()
	local f <close> = (function()
		local _with_0 = io.open("file.txt")
		_with_0:write("Hello")
		return _with_0
	end)()
end
do
	local _ <close> = (function()
		local _with_0 = io.open("file.txt")
		_with_0:write("Hello")
		return _with_0
	end)();
	local _ <close> = setmetatable({ }, {
		__close = function(self)
			return print("second")
		end
	});
	local _ <close> = setmetatable({ }, {
		__close = function()
			return print("first")
		end
	})
end
local _defers = setmetatable({ }, {
	__close = function(self)
		self[#self]()
		self[#self] = nil
	end
})
do
	_defers[#_defers + 1] = function()
		return print(3)
	end
	local _ <close> = _defers;
	_defers[#_defers + 1] = function()
		return print(2)
	end
	local _ <close> = _defers;
	_defers[#_defers + 1] = function()
		return print(1)
	end
	local _ <close> = _defers
end