@@ -7,8 +7,7 @@ function ____exports.__main(self)
77 local out = { }
88 repeat
99 local ____switch3 = 5
10- local ____cond3 = false
11- ____cond3 = ____cond3 or (((____switch3 == 0) or (____switch3 == 1)) or (____switch3 == 2))
10+ local ____cond3 = ((____switch3 == 0) or (____switch3 == 1)) or (____switch3 == 2)
1211 if ____cond3 then
1312 __TS__ArrayPush(out, \\ "0,1,2\\ ")
1413 end
@@ -17,9 +16,6 @@ function ____exports.__main(self)
1716 __TS__ArrayPush(out, \\ "3\\ ")
1817 break
1918 end
20- if ____cond3 then
21- __TS__ArrayPush(out, \\ "default\\ ")
22- end
2319 ____cond3 = ____cond3 or (____switch3 == 4)
2420 if ____cond3 then
2521 __TS__ArrayPush(out, \\ "4\\ ")
3430return ____exports"
3531` ;
3632
33+ exports [` switch handles side-effects (0) 1` ] = `
34+ "require(\\ "lualib_bundle\\ ");
35+ local ____exports = { }
36+ function ____exports.__main(self)
37+ local out = { }
38+ local y = 0
39+ local function foo(self)
40+ return (function()
41+ local ____tmp = y
42+ y = ____tmp + 1
43+ return ____tmp
44+ end)()
45+ end
46+ local x = 0
47+ repeat
48+ local ____switch5 = x
49+ local ____cond5 = ____switch5 == foo(nil)
50+ if ____cond5 then
51+ __TS__ArrayPush(out, 1)
52+ end
53+ ____cond5 = ____cond5 or (____switch5 == foo(nil))
54+ if ____cond5 then
55+ __TS__ArrayPush(out, 2)
56+ end
57+ ____cond5 = ____cond5 or (____switch5 == foo(nil))
58+ if ____cond5 then
59+ __TS__ArrayPush(out, 3)
60+ end
61+ if ____cond5 then
62+ __TS__ArrayPush(out, \\ "default\\ ")
63+ end
64+ if not ____cond5 then
65+ __TS__ArrayPush(out, \\ "default\\ ")
66+ end
67+ until true
68+ __TS__ArrayPush(out, y)
69+ return out
70+ end
71+ return ____exports"
72+ ` ;
73+
74+ exports [` switch handles side-effects (1) 1` ] = `
75+ "require(\\ "lualib_bundle\\ ");
76+ local ____exports = { }
77+ function ____exports.__main(self)
78+ local out = { }
79+ local y = 0
80+ local function foo(self)
81+ return (function()
82+ local ____tmp = y
83+ y = ____tmp + 1
84+ return ____tmp
85+ end)()
86+ end
87+ local x = 1
88+ repeat
89+ local ____switch5 = x
90+ local ____cond5 = ____switch5 == foo(nil)
91+ if ____cond5 then
92+ __TS__ArrayPush(out, 1)
93+ end
94+ ____cond5 = ____cond5 or (____switch5 == foo(nil))
95+ if ____cond5 then
96+ __TS__ArrayPush(out, 2)
97+ end
98+ ____cond5 = ____cond5 or (____switch5 == foo(nil))
99+ if ____cond5 then
100+ __TS__ArrayPush(out, 3)
101+ end
102+ if ____cond5 then
103+ __TS__ArrayPush(out, \\ "default\\ ")
104+ end
105+ if not ____cond5 then
106+ __TS__ArrayPush(out, \\ "default\\ ")
107+ end
108+ until true
109+ __TS__ArrayPush(out, y)
110+ return out
111+ end
112+ return ____exports"
113+ ` ;
114+
115+ exports [` switch handles side-effects (2) 1` ] = `
116+ "require(\\ "lualib_bundle\\ ");
117+ local ____exports = { }
118+ function ____exports.__main(self)
119+ local out = { }
120+ local y = 0
121+ local function foo(self)
122+ return (function()
123+ local ____tmp = y
124+ y = ____tmp + 1
125+ return ____tmp
126+ end)()
127+ end
128+ local x = 2
129+ repeat
130+ local ____switch5 = x
131+ local ____cond5 = ____switch5 == foo(nil)
132+ if ____cond5 then
133+ __TS__ArrayPush(out, 1)
134+ end
135+ ____cond5 = ____cond5 or (____switch5 == foo(nil))
136+ if ____cond5 then
137+ __TS__ArrayPush(out, 2)
138+ end
139+ ____cond5 = ____cond5 or (____switch5 == foo(nil))
140+ if ____cond5 then
141+ __TS__ArrayPush(out, 3)
142+ end
143+ if ____cond5 then
144+ __TS__ArrayPush(out, \\ "default\\ ")
145+ end
146+ if not ____cond5 then
147+ __TS__ArrayPush(out, \\ "default\\ ")
148+ end
149+ until true
150+ __TS__ArrayPush(out, y)
151+ return out
152+ end
153+ return ____exports"
154+ ` ;
155+
156+ exports [` switch handles side-effects (3) 1` ] = `
157+ "require(\\ "lualib_bundle\\ ");
158+ local ____exports = { }
159+ function ____exports.__main(self)
160+ local out = { }
161+ local y = 0
162+ local function foo(self)
163+ return (function()
164+ local ____tmp = y
165+ y = ____tmp + 1
166+ return ____tmp
167+ end)()
168+ end
169+ local x = 3
170+ repeat
171+ local ____switch5 = x
172+ local ____cond5 = ____switch5 == foo(nil)
173+ if ____cond5 then
174+ __TS__ArrayPush(out, 1)
175+ end
176+ ____cond5 = ____cond5 or (____switch5 == foo(nil))
177+ if ____cond5 then
178+ __TS__ArrayPush(out, 2)
179+ end
180+ ____cond5 = ____cond5 or (____switch5 == foo(nil))
181+ if ____cond5 then
182+ __TS__ArrayPush(out, 3)
183+ end
184+ if ____cond5 then
185+ __TS__ArrayPush(out, \\ "default\\ ")
186+ end
187+ if not ____cond5 then
188+ __TS__ArrayPush(out, \\ "default\\ ")
189+ end
190+ until true
191+ __TS__ArrayPush(out, y)
192+ return out
193+ end
194+ return ____exports"
195+ ` ;
196+
37197exports [` switch uses elseif 1` ] = `
38198"local ____exports = { }
39199function ____exports.__main(self)
40200 local result = -1
41201 repeat
42202 local ____switch3 = 2
43- local ____cond3 = false
44- ____cond3 = ____cond3 or (____switch3 == 0)
203+ local ____cond3 = ____switch3 == 0
45204 if ____cond3 then
46205 do
47206 result = 200
0 commit comments