aboutsummaryrefslogtreecommitdiff
path: root/spec/outputs/export.lua
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2021-10-12 10:04:44 +0800
committerLi Jin <dragon-fly@qq.com>2021-10-12 10:04:44 +0800
commit60a979e224f26117f5be82bfca757a2483cef0fd (patch)
tree7c6af44f6dcada1f23979b820ba830251997b161 /spec/outputs/export.lua
parenta19b242cbaf53721b20a3163dd06f43e9ef2b487 (diff)
downloadyuescript-60a979e224f26117f5be82bfca757a2483cef0fd.tar.gz
yuescript-60a979e224f26117f5be82bfca757a2483cef0fd.tar.bz2
yuescript-60a979e224f26117f5be82bfca757a2483cef0fd.zip
fix test.
Diffstat (limited to 'spec/outputs/export.lua')
-rw-r--r--spec/outputs/export.lua307
1 files changed, 307 insertions, 0 deletions
diff --git a/spec/outputs/export.lua b/spec/outputs/export.lua
new file mode 100644
index 0000000..02546ec
--- /dev/null
+++ b/spec/outputs/export.lua
@@ -0,0 +1,307 @@
1local _module_0 = { }
2local a, b, c = 223, 343, 123
3_module_0["a"], _module_0["b"], _module_0["c"] = a, b, c
4local cool = "dad"
5_module_0["cool"] = cool
6local d, e, f = 3, 2, 1
7_module_0[#_module_0 + 1] = d
8_module_0[#_module_0 + 1] = e
9_module_0[#_module_0 + 1] = f
10local Something
11do
12 local _class_0
13 local _base_0 = {
14 umm = "cool"
15 }
16 _base_0.__index = _base_0
17 _class_0 = setmetatable({
18 __init = function() end,
19 __base = _base_0,
20 __name = "Something"
21 }, {
22 __index = _base_0,
23 __call = function(cls, ...)
24 local _self_0 = setmetatable({ }, _base_0)
25 cls.__init(_self_0, ...)
26 return _self_0
27 end
28 })
29 _base_0.__class = _class_0
30 Something = _class_0
31end
32_module_0["Something"] = Something
33if this then
34 _module_0[#_module_0 + 1] = 232
35else
36 _module_0[#_module_0 + 1] = 4343
37end
38local What
39if this then
40 What = 232
41else
42 What = 4343
43end
44_module_0["What"] = What
45local y
46y = function()
47 local hallo = 3434
48end
49_module_0["y"] = y
50do
51 local _with_0 = tmp
52 local j = 2000
53 _module_0[#_module_0 + 1] = _with_0
54end
55local cbVal
56do
57 local h = 100
58 cbVal = f(function(x)
59 return x(h)
60 end)
61end
62_module_0["cbVal"] = cbVal
63y = function()
64 local h = 100
65 local k = 100
66end
67_module_0["y"] = y
68local _exp_0 = h
69if 100 == _exp_0 or 150 == _exp_0 then
70 _module_0[#_module_0 + 1] = 200
71elseif 200 == _exp_0 then
72 _module_0[#_module_0 + 1] = 300
73else
74 _module_0[#_module_0 + 1] = 0
75end
76local Constant
77local _exp_1 = value
78if "good" == _exp_1 then
79 Constant = 1
80elseif "better" == _exp_1 then
81 Constant = 2
82elseif "best" == _exp_1 then
83 Constant = 3
84end
85_module_0["Constant"] = Constant
86local item = func(123)
87_module_0["item"] = item
88_module_0[#_module_0 + 1] = x
89f((function()
90 if a then
91 return b
92 end
93end)())
94f((function()
95 return 123
96end)())
97f((function()
98 if b == a then
99 return c
100 end
101end)())
102f((function()
103 local _accum_0 = { }
104 local _len_0 = 1
105 for i = 1, 10 do
106 _accum_0[_len_0] = i
107 _len_0 = _len_0 + 1
108 end
109 return _accum_0
110end)())
111f((function()
112 local _accum_0 = { }
113 local _len_0 = 1
114 for i = 1, 10 do
115 _accum_0[_len_0] = i
116 _len_0 = _len_0 + 1
117 end
118 return _accum_0
119end)())
120f((function()
121 local _tbl_0 = { }
122 for k, v in pairs(tb) do
123 _tbl_0[k] = v
124 end
125 return _tbl_0
126end)())
127f((function()
128 local _accum_0 = { }
129 local _len_0 = 1
130 for k, v in pairs(tb) do
131 _accum_0[_len_0] = k, v
132 _len_0 = _len_0 + 1
133 end
134 return _accum_0
135end)())
136f((function()
137 local _accum_0 = { }
138 local _len_0 = 1
139 while a do
140 _accum_0[_len_0] = true
141 _len_0 = _len_0 + 1
142 end
143 return _accum_0
144end)())
145f((function()
146 a.b = 123
147 return a
148end)())
149f((function()
150 if a ~= nil then
151 return a.b
152 end
153 return nil
154end)())
155f((function()
156 local _base_0 = a
157 local _fn_0 = _base_0.b
158 return _fn_0 and function(...)
159 return _fn_0(_base_0, ...)
160 end
161end)())
162f((function()
163 local A
164 do
165 local _class_0
166 local _base_0 = { }
167 _base_0.__index = _base_0
168 _class_0 = setmetatable({
169 __init = function() end,
170 __base = _base_0,
171 __name = "A"
172 }, {
173 __index = _base_0,
174 __call = function(cls, ...)
175 local _self_0 = setmetatable({ }, _base_0)
176 cls.__init(_self_0, ...)
177 return _self_0
178 end
179 })
180 _base_0.__class = _class_0
181 A = _class_0
182 return _class_0
183 end
184end)())
185local _ = tostring((function()
186 if a then
187 return b
188 end
189end)())
190_ = tostring((function()
191 return 123
192end)())
193_ = tostring((function()
194 if b == a then
195 return c
196 end
197end)())
198_ = tostring((function()
199 local _accum_0 = { }
200 local _len_0 = 1
201 for i = 1, 10 do
202 _accum_0[_len_0] = i
203 _len_0 = _len_0 + 1
204 end
205 return _accum_0
206end)())
207_ = tostring((function()
208 local _accum_0 = { }
209 local _len_0 = 1
210 for i = 1, 10 do
211 _accum_0[_len_0] = i
212 _len_0 = _len_0 + 1
213 end
214 return _accum_0
215end)())
216_ = tostring((function()
217 local _tbl_0 = { }
218 for k, v in pairs(tb) do
219 _tbl_0[k] = v
220 end
221 return _tbl_0
222end)())
223_ = tostring((function()
224 local _accum_0 = { }
225 local _len_0 = 1
226 for k, v in pairs(tb) do
227 _accum_0[_len_0] = k, v
228 _len_0 = _len_0 + 1
229 end
230 return _accum_0
231end)())
232_ = tostring((function()
233 local _accum_0 = { }
234 local _len_0 = 1
235 while a do
236 _accum_0[_len_0] = true
237 _len_0 = _len_0 + 1
238 end
239 return _accum_0
240end)())
241_ = tostring((function()
242 a.b = 123
243 return a
244end)())
245_ = tostring((function()
246 if a ~= nil then
247 return a.b
248 end
249 return nil
250end)())
251_ = tostring((function()
252 local _base_0 = a
253 local _fn_0 = _base_0.b
254 return _fn_0 and function(...)
255 return _fn_0(_base_0, ...)
256 end
257end)())
258_ = tostring((function()
259 local A
260 do
261 local _class_0
262 local _base_0 = { }
263 _base_0.__index = _base_0
264 _class_0 = setmetatable({
265 __init = function() end,
266 __base = _base_0,
267 __name = "A"
268 }, {
269 __index = _base_0,
270 __call = function(cls, ...)
271 local _self_0 = setmetatable({ }, _base_0)
272 cls.__init(_self_0, ...)
273 return _self_0
274 end
275 })
276 _base_0.__class = _class_0
277 A = _class_0
278 return _class_0
279 end
280end)())
281local v1, v2, v3, v4, v5
282v1 = 1
283v2 = 2
284_module_0["v2"] = v2
285do
286 local _class_0
287 local _base_0 = { }
288 _base_0.__index = _base_0
289 _class_0 = setmetatable({
290 __init = function() end,
291 __base = _base_0,
292 __name = "v4"
293 }, {
294 __index = _base_0,
295 __call = function(cls, ...)
296 local _self_0 = setmetatable({ }, _base_0)
297 cls.__init(_self_0, ...)
298 return _self_0
299 end
300 })
301 _base_0.__class = _class_0
302 v4 = _class_0
303 v3 = _class_0
304end
305_module_0["v3"] = v3
306v5 = 5
307return _module_0