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
|
local a <const>, b <const>, c <const>, d <const> = 1, 2, 3, 4
do
local a, b = setmetatable({ }, {
__close = function(self)
return print("closed")
end
})
local _close_0 <close> = a
local _close_1 <close> = b
local c <const>, d <const> = 123, 'abc'
close(a, b)
const(c, d)
end
do
local a <const> = 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
local _obj_0 = {
2,
3
}
a, b = _obj_0[1], _obj_0[2]
end
do
local v
if flag then
v = func()
else
v = setmetatable({ }, {
__close = function(self) end
})
end
local _close_0 <close> = v
local f
local _with_0 = io.open("file.txt")
_with_0:write("Hello")
f = _with_0
local _close_1 <close> = f
end
do
local a
if true then
a = 1
end
local b
if not false then
if x then
b = 1
end
end
local _close_0 <close> = b
local c
if true then
local _exp_0 = x
if "abc" == _exp_0 then
c = 998
end
end
local d
if (function()
if a ~= nil then
return a
else
return b
end
end)() then
d = {
value = value
}
end
local _close_1 <close> = d
end
do
local _
do
local _with_0 = io.open("file.txt")
_with_0:write("Hello")
_ = _with_0
end
local _close_0 <close> = _
local _ <close> = setmetatable({ }, {
__close = function()
return print("second")
end
})
local _ <close> = setmetatable({ }, {
__close = function()
return print("first")
end
})
print("third")
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 _ <close> = def(function()
return print(3)
end)
local _ <close> = def(function()
return print(2)
end)
local _ <close> = def(function()
return print(1)
end)
end
|