aboutsummaryrefslogtreecommitdiff
path: root/spec/outputs/unicode/switch.lua
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2024-03-21 09:14:34 +0800
committerLi Jin <dragon-fly@qq.com>2024-03-21 09:14:34 +0800
commit4a3cc26c6dfd74e61c8b6480038d6a292ea86e47 (patch)
tree9554b94cfc15e4acee0c2e60b63af16f1b828207 /spec/outputs/unicode/switch.lua
parent80b65520da432843f0c63431a1867bd2620bc4ac (diff)
downloadyuescript-4a3cc26c6dfd74e61c8b6480038d6a292ea86e47.tar.gz
yuescript-4a3cc26c6dfd74e61c8b6480038d6a292ea86e47.tar.bz2
yuescript-4a3cc26c6dfd74e61c8b6480038d6a292ea86e47.zip
remove redundant 'do' blocks in code generation.
Diffstat (limited to 'spec/outputs/unicode/switch.lua')
-rw-r--r--spec/outputs/unicode/switch.lua366
1 files changed, 175 insertions, 191 deletions
diff --git a/spec/outputs/unicode/switch.lua b/spec/outputs/unicode/switch.lua
index 6b8bbdc..76c078c 100644
--- a/spec/outputs/unicode/switch.lua
+++ b/spec/outputs/unicode/switch.lua
@@ -45,13 +45,11 @@ do
45end 45end
46do 46do
47 local _with_0 = _u4e1c_u897f 47 local _with_0 = _u4e1c_u897f
48 do 48 local _exp_0 = _with_0["值"](_with_0)
49 local _exp_0 = _with_0["值"](_with_0) 49 if _with_0["确定"] == _exp_0 then
50 if _with_0["确定"] == _exp_0 then 50 local _u53d8_u91cf_ = "世界"
51 local _u53d8_u91cf_ = "世界" 51 else
52 else 52 local _u53d8_u91cf_ = "是的"
53 local _u53d8_u91cf_ = "是的"
54 end
55 end 53 end
56end 54end
57_u4fee_u590d(_u8fd9_u4e2a) 55_u4fee_u590d(_u8fd9_u4e2a)
@@ -106,66 +104,64 @@ do
106 } 104 }
107 } 105 }
108 } 106 }
109 do 107 local _type_0 = type(_u5b57_u5178)
110 local _type_0 = type(_u5b57_u5178) 108 local _tab_0 = "table" == _type_0 or "userdata" == _type_0
111 local _tab_0 = "table" == _type_0 or "userdata" == _type_0 109 if _tab_0 then
112 if _tab_0 then 110 local _u7b2c_u4e00 = _u5b57_u5178[1]
113 local _u7b2c_u4e00 = _u5b57_u5178[1] 111 local _u4e00_u4e2a
114 local _u4e00_u4e2a 112 do
115 do 113 local _obj_0 = _u5b57_u5178[2]
116 local _obj_0 = _u5b57_u5178[2] 114 local _type_1 = type(_obj_0)
117 local _type_1 = type(_obj_0) 115 if "table" == _type_1 or "userdata" == _type_1 then
118 if "table" == _type_1 or "userdata" == _type_1 then 116 _u4e00_u4e2a = _obj_0[1]
119 _u4e00_u4e2a = _obj_0[1]
120 end
121 end 117 end
122 local _u4e24_u4e2a 118 end
123 do 119 local _u4e24_u4e2a
124 local _obj_0 = _u5b57_u5178[2] 120 do
125 local _type_1 = type(_obj_0) 121 local _obj_0 = _u5b57_u5178[2]
126 if "table" == _type_1 or "userdata" == _type_1 then 122 local _type_1 = type(_obj_0)
127 _u4e24_u4e2a = _obj_0[2] 123 if "table" == _type_1 or "userdata" == _type_1 then
128 end 124 _u4e24_u4e2a = _obj_0[2]
129 end 125 end
130 local _u4e09_u4e2a 126 end
131 do 127 local _u4e09_u4e2a
132 local _obj_0 = _u5b57_u5178[2] 128 do
133 local _type_1 = type(_obj_0) 129 local _obj_0 = _u5b57_u5178[2]
134 if "table" == _type_1 or "userdata" == _type_1 then 130 local _type_1 = type(_obj_0)
135 _u4e09_u4e2a = _obj_0[3] 131 if "table" == _type_1 or "userdata" == _type_1 then
136 end 132 _u4e09_u4e2a = _obj_0[3]
137 end 133 end
138 local _u53d8_u91cfc 134 end
139 do 135 local _u53d8_u91cfc
140 local _obj_0 = _u5b57_u5178["变量a"] 136 do
141 local _type_1 = type(_obj_0) 137 local _obj_0 = _u5b57_u5178["变量a"]
142 if "table" == _type_1 or "userdata" == _type_1 then 138 local _type_1 = type(_obj_0)
143 do 139 if "table" == _type_1 or "userdata" == _type_1 then
144 local _obj_1 = _obj_0["变量b"] 140 do
145 local _type_2 = type(_obj_1) 141 local _obj_1 = _obj_0["变量b"]
146 if "table" == _type_2 or "userdata" == _type_2 then 142 local _type_2 = type(_obj_1)
147 _u53d8_u91cfc = _obj_1["变量c"] 143 if "table" == _type_2 or "userdata" == _type_2 then
148 end 144 _u53d8_u91cfc = _obj_1["变量c"]
149 end 145 end
150 end 146 end
151 end 147 end
152 local _u53d8_u91cfz 148 end
153 do 149 local _u53d8_u91cfz
154 local _obj_0 = _u5b57_u5178["变量x"] 150 do
155 local _type_1 = type(_obj_0) 151 local _obj_0 = _u5b57_u5178["变量x"]
156 if "table" == _type_1 or "userdata" == _type_1 then 152 local _type_1 = type(_obj_0)
157 do 153 if "table" == _type_1 or "userdata" == _type_1 then
158 local _obj_1 = _obj_0["变量y"] 154 do
159 local _type_2 = type(_obj_1) 155 local _obj_1 = _obj_0["变量y"]
160 if "table" == _type_2 or "userdata" == _type_2 then 156 local _type_2 = type(_obj_1)
161 _u53d8_u91cfz = _obj_1["变量z"] 157 if "table" == _type_2 or "userdata" == _type_2 then
162 end 158 _u53d8_u91cfz = _obj_1["变量z"]
163 end 159 end
164 end 160 end
165 end 161 end
166 if _u7b2c_u4e00 ~= nil and _u4e00_u4e2a ~= nil and _u4e24_u4e2a ~= nil and _u4e09_u4e2a ~= nil and _u53d8_u91cfc ~= nil and _u53d8_u91cfz ~= nil then 162 end
167 _u6253_u5370(_u7b2c_u4e00, _u4e00_u4e2a, _u4e24_u4e2a, _u4e09_u4e2a, _u53d8_u91cfc, _u53d8_u91cfz) 163 if _u7b2c_u4e00 ~= nil and _u4e00_u4e2a ~= nil and _u4e24_u4e2a ~= nil and _u4e09_u4e2a ~= nil and _u53d8_u91cfc ~= nil and _u53d8_u91cfz ~= nil then
168 end 164 _u6253_u5370(_u7b2c_u4e00, _u4e00_u4e2a, _u4e24_u4e2a, _u4e09_u4e2a, _u53d8_u91cfc, _u53d8_u91cfz)
169 end 165 end
170 end 166 end
171end 167end
@@ -183,56 +179,54 @@ do
183 } 179 }
184 for _index_0 = 1, #_u7269_u54c1 do 180 for _index_0 = 1, #_u7269_u54c1 do
185 local _u7269 = _u7269_u54c1[_index_0] 181 local _u7269 = _u7269_u54c1[_index_0]
186 do 182 local _type_0 = type(_u7269)
187 local _type_0 = type(_u7269) 183 local _tab_0 = "table" == _type_0 or "userdata" == _type_0
188 local _tab_0 = "table" == _type_0 or "userdata" == _type_0 184 local _match_0 = false
189 local _match_0 = false 185 if _tab_0 then
186 local _u53d8_u91cfx = _u7269["变量x"]
187 local _u53d8_u91cfy = _u7269["变量y"]
188 if _u53d8_u91cfx ~= nil and _u53d8_u91cfy ~= nil then
189 _match_0 = true
190 _u6253_u5370("Vec2 " .. tostring(_u53d8_u91cfx) .. ", " .. tostring(_u53d8_u91cfy))
191 end
192 end
193 if not _match_0 then
194 local _match_1 = false
190 if _tab_0 then 195 if _tab_0 then
191 local _u53d8_u91cfx = _u7269["量x"] 196 local _u5bbd_u5ea6 = _u7269[""]
192 local _u53d8_u91cfy = _u7269["y"] 197 local _u9ad8_u5ea6 = _u7269[""]
193 if _u53d8_u91cfx ~= nil and _u53d8_u91cfy ~= nil then 198 if _u5bbd_u5ea6 ~= nil and _u9ad8_u5ea6 ~= nil then
194 _match_0 = true 199 _match_1 = true
195 _u6253_u5370("Vec2 " .. tostring(_u53d8_u91cfx) .. ", " .. tostring(_u53d8_u91cfy)) 200 _u6253_u5370("Size " .. tostring(_u5bbd_u5ea6) .. ", " .. tostring(_u9ad8_u5ea6))
196 end 201 end
197 end 202 end
198 if not _match_0 then 203 if not _match_1 then
199 local _match_1 = false 204 if false == _u7269 then
200 if _tab_0 then 205 _u6253_u5370("没有")
201 local _u5bbd_u5ea6 = _u7269["宽度"] 206 else
202 local _u9ad8_u5ea6 = _u7269["高度"] 207 local _match_2 = false
203 if _u5bbd_u5ea6 ~= nil and _u9ad8_u5ea6 ~= nil then 208 if _tab_0 then
204 _match_1 = true 209 local _u7c7b = _u7269["__类"]
205 _u6253_u5370("Size " .. tostring(_u5bbd_u5ea6) .. ", " .. tostring(_u9ad8_u5ea6)) 210 if _u7c7b ~= nil then
211 _match_2 = true
212 if _u7c7b_u522bA == _u7c7b then
213 _u6253_u5370("对象 A")
214 elseif _u7c7b_u522bB == _u7c7b then
215 _u6253_u5370("对象 B")
216 end
217 end
206 end 218 end
207 end 219 if not _match_2 then
208 if not _match_1 then 220 local _match_3 = false
209 if false == _u7269 then
210 _u6253_u5370("没有")
211 else
212 local _match_2 = false
213 if _tab_0 then 221 if _tab_0 then
214 local _u7c7b = _u7269["__类"] 222 local _u8868 = getmetatable(_u7269)
215 if _u7c7b ~= nil then 223 if _u8868 ~= nil then
216 _match_2 = true 224 _match_3 = true
217 if _u7c7b_u522bA == _u7c7b then 225 _u6253_u5370("带有元表的表")
218 _u6253_u5370("对象 A")
219 elseif _u7c7b_u522bB == _u7c7b then
220 _u6253_u5370("对象 B")
221 end
222 end 226 end
223 end 227 end
224 if not _match_2 then 228 if not _match_3 then
225 local _match_3 = false 229 _u6253_u5370("物品不被接受!")
226 if _tab_0 then
227 local _u8868 = getmetatable(_u7269)
228 if _u8868 ~= nil then
229 _match_3 = true
230 _u6253_u5370("带有元表的表")
231 end
232 end
233 if not _match_3 then
234 _u6253_u5370("物品不被接受!")
235 end
236 end 230 end
237 end 231 end
238 end 232 end
@@ -271,72 +265,66 @@ do
271 end 265 end
272 end 266 end
273 end 267 end
274 do 268 local _type_0 = type(_u8868_u683c)
275 local _type_0 = type(_u8868_u683c) 269 local _tab_0 = "table" == _type_0 or "userdata" == _type_0
276 local _tab_0 = "table" == _type_0 or "userdata" == _type_0 270 local _match_0 = false
277 local _match_0 = false 271 if _tab_0 then
278 if _tab_0 then 272 local _u53d8_u91cfa = _u8868_u683c["变量a"]
279 local _u53d8_u91cfa = _u8868_u683c["变量a"] 273 local _u53d8_u91cfb = _u8868_u683c["变量b"]
280 local _u53d8_u91cfb = _u8868_u683c["变量b"] 274 if _u53d8_u91cfa ~= nil and _u53d8_u91cfb ~= nil then
281 if _u53d8_u91cfa ~= nil and _u53d8_u91cfb ~= nil then 275 _match_0 = true
282 _match_0 = true 276 _u6253_u5370(_u53d8_u91cfa, _u53d8_u91cfb)
283 _u6253_u5370(_u53d8_u91cfa, _u53d8_u91cfb)
284 end
285 end
286 if not _match_0 then
287 _u6253_u5370("没有匹配")
288 end 277 end
289 end 278 end
279 if not _match_0 then
280 _u6253_u5370("没有匹配")
281 end
290end 282end
291do 283do
292 local _u8868_u683c = { 284 local _u8868_u683c = {
293 ["变量x"] = "abc" 285 ["变量x"] = "abc"
294 } 286 }
295 do 287 local _type_0 = type(_u8868_u683c)
296 local _type_0 = type(_u8868_u683c) 288 local _tab_0 = "table" == _type_0 or "userdata" == _type_0
297 local _tab_0 = "table" == _type_0 or "userdata" == _type_0 289 local _match_0 = false
298 local _match_0 = false 290 if _tab_0 then
291 local _u53d8_u91cfx = _u8868_u683c["变量x"]
292 local _u53d8_u91cfy = _u8868_u683c["变量y"]
293 if _u53d8_u91cfx ~= nil and _u53d8_u91cfy ~= nil then
294 _match_0 = true
295 _u6253_u5370("变量x: " .. tostring(_u53d8_u91cfx) .. " 和 变量y: " .. tostring(_u53d8_u91cfy))
296 end
297 end
298 if not _match_0 then
299 if _tab_0 then 299 if _tab_0 then
300 local _u53d8_u91cfx = _u8868_u683c["变量x"] 300 local _u53d8_u91cfx = _u8868_u683c["变量x"]
301 local _u53d8_u91cfy = _u8868_u683c["变量y"] 301 if _u53d8_u91cfx ~= nil then
302 if _u53d8_u91cfx ~= nil and _u53d8_u91cfy ~= nil then 302 _u6253_u5370("只有 变量x: " .. tostring(_u53d8_u91cfx))
303 _match_0 = true
304 _u6253_u5370("变量x: " .. tostring(_u53d8_u91cfx) .. " 和 变量y: " .. tostring(_u53d8_u91cfy))
305 end
306 end
307 if not _match_0 then
308 if _tab_0 then
309 local _u53d8_u91cfx = _u8868_u683c["变量x"]
310 if _u53d8_u91cfx ~= nil then
311 _u6253_u5370("只有 变量x: " .. tostring(_u53d8_u91cfx))
312 end
313 end 303 end
314 end 304 end
315 end 305 end
316end 306end
317do 307do
318 local _u5339_u914d 308 local _u5339_u914d
319 do 309 local _exp_0 = _u8868_u683c
320 local _exp_0 = _u8868_u683c 310 if 1 == _exp_0 then
321 if 1 == _exp_0 then 311 _u5339_u914d = "1"
322 _u5339_u914d = "1" 312 else
323 else 313 local _type_0 = type(_exp_0)
324 local _type_0 = type(_exp_0) 314 local _tab_0 = "table" == _type_0 or "userdata" == _type_0
325 local _tab_0 = "table" == _type_0 or "userdata" == _type_0 315 local _match_0 = false
326 local _match_0 = false 316 if _tab_0 then
327 if _tab_0 then 317 local _u53d8_u91cfx = _exp_0["变量x"]
328 local _u53d8_u91cfx = _exp_0["变量x"] 318 if _u53d8_u91cfx ~= nil then
329 if _u53d8_u91cfx ~= nil then 319 _match_0 = true
330 _match_0 = true 320 _u5339_u914d = _u53d8_u91cfx
331 _u5339_u914d = _u53d8_u91cfx
332 end
333 end 321 end
334 if not _match_0 then 322 end
335 if false == _exp_0 then 323 if not _match_0 then
336 _u5339_u914d = "false" 324 if false == _exp_0 then
337 else 325 _u5339_u914d = "false"
338 _u5339_u914d = nil 326 else
339 end 327 _u5339_u914d = nil
340 end 328 end
341 end 329 end
342 end 330 end
@@ -346,55 +334,51 @@ do
346 if nil == _exp_0 then 334 if nil == _exp_0 then
347 return "无效" 335 return "无效"
348 else 336 else
349 do 337 local _type_0 = type(_exp_0)
350 local _type_0 = type(_exp_0) 338 local _tab_0 = "table" == _type_0 or "userdata" == _type_0
351 local _tab_0 = "table" == _type_0 or "userdata" == _type_0 339 local _match_0 = false
352 local _match_0 = false 340 if _tab_0 then
353 if _tab_0 then 341 local _u53d8_u91cfa = _exp_0["变量a"]
354 local _u53d8_u91cfa = _exp_0["变量a"] 342 local _u53d8_u91cfb = _exp_0["变量b"]
355 local _u53d8_u91cfb = _exp_0["变量b"] 343 if _u53d8_u91cfa ~= nil and _u53d8_u91cfb ~= nil then
356 if _u53d8_u91cfa ~= nil and _u53d8_u91cfb ~= nil then 344 _match_0 = true
357 _match_0 = true 345 return tostring(_u53d8_u91cfa + _u53d8_u91cfb)
358 return tostring(_u53d8_u91cfa + _u53d8_u91cfb)
359 end
360 end 346 end
361 if not _match_0 then 347 end
362 if 1 == _exp_0 or 2 == _exp_0 or 3 == _exp_0 or 4 == _exp_0 or 5 == _exp_0 then 348 if not _match_0 then
363 return "数字 1 - 5" 349 if 1 == _exp_0 or 2 == _exp_0 or 3 == _exp_0 or 4 == _exp_0 or 5 == _exp_0 then
364 else 350 return "数字 1 - 5"
365 local _match_1 = false 351 else
366 if _tab_0 then 352 local _match_1 = false
367 local _u5339_u914d_u4efb_u4f55_u8868_u683c = _exp_0["匹配任何表格"] 353 if _tab_0 then
368 if _u5339_u914d_u4efb_u4f55_u8868_u683c == nil then 354 local _u5339_u914d_u4efb_u4f55_u8868_u683c = _exp_0["匹配任何表格"]
369 _u5339_u914d_u4efb_u4f55_u8868_u683c = "后备" 355 if _u5339_u914d_u4efb_u4f55_u8868_u683c == nil then
370 end 356 _u5339_u914d_u4efb_u4f55_u8868_u683c = "后备"
371 _match_1 = true
372 return _u5339_u914d_u4efb_u4f55_u8868_u683c
373 end
374 if not _match_1 then
375 return "除非它不是一个表格,否则不应到达这里"
376 end 357 end
358 _match_1 = true
359 return _u5339_u914d_u4efb_u4f55_u8868_u683c
360 end
361 if not _match_1 then
362 return "除非它不是一个表格,否则不应到达这里"
377 end 363 end
378 end 364 end
379 end 365 end
380 end 366 end
381end 367end
382do 368do
383 do 369 local _exp_0 = _u53d8_u91cfy
384 local _exp_0 = _u53d8_u91cfy 370 local _type_0 = type(_exp_0)
385 local _type_0 = type(_exp_0) 371 local _tab_0 = "table" == _type_0 or "userdata" == _type_0
386 local _tab_0 = "table" == _type_0 or "userdata" == _type_0 372 if _tab_0 then
387 if _tab_0 then 373 local _u8868 = (function()
388 local _u8868 = (function() 374 local _obj_0 = _exp_0["变量x"]
389 local _obj_0 = _exp_0["变量x"] 375 if _obj_0 ~= nil then
390 if _obj_0 ~= nil then 376 return getmetatable(_obj_0)
391 return getmetatable(_obj_0)
392 end
393 return nil
394 end)()
395 if _u8868 ~= nil then
396 _u6253_u5370(_u8868)
397 end 377 end
378 return nil
379 end)()
380 if _u8868 ~= nil then
381 _u6253_u5370(_u8868)
398 end 382 end
399 end 383 end
400end 384end