aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2023-01-29 16:39:35 +0800
committerLi Jin <dragon-fly@qq.com>2023-01-29 16:39:35 +0800
commit8d648dc8c075fc1cf8d89d74c1425cdeb47e8089 (patch)
treed038d12f7e683e490a36d431376c2da6dd2b17bf /spec
parente10b1b163a9a173f32b956bf1fb9be00194352b5 (diff)
downloadyuescript-8d648dc8c075fc1cf8d89d74c1425cdeb47e8089.tar.gz
yuescript-8d648dc8c075fc1cf8d89d74c1425cdeb47e8089.tar.bz2
yuescript-8d648dc8c075fc1cf8d89d74c1425cdeb47e8089.zip
refactor break loop keyword checking.
Diffstat (limited to 'spec')
-rw-r--r--spec/inputs/loops.yue24
-rw-r--r--spec/outputs/5.1/loops.lua60
-rw-r--r--spec/outputs/loops.lua41
3 files changed, 124 insertions, 1 deletions
diff --git a/spec/inputs/loops.yue b/spec/inputs/loops.yue
index 51eb10b..5cadbf0 100644
--- a/spec/inputs/loops.yue
+++ b/spec/inputs/loops.yue
@@ -173,4 +173,26 @@ do
173 for thing in *xxx 173 for thing in *xxx
174 print thing 174 print thing
175 175
176 176do
177 for i = 1, 10
178 repeat
179 with? tb
180 .a = 1
181 continue if .b
182 do
183 if .c
184 break
185 until true
186 switch x
187 when 123
188 break
189 else
190 continue
191 if y
192 continue
193 else
194 break
195 do do do
196 print i
197 continue
198 print "abc"
diff --git a/spec/outputs/5.1/loops.lua b/spec/outputs/5.1/loops.lua
index 85e9de8..6f0d072 100644
--- a/spec/outputs/5.1/loops.lua
+++ b/spec/outputs/5.1/loops.lua
@@ -382,3 +382,63 @@ do
382 print(thing) 382 print(thing)
383 end 383 end
384end 384end
385do
386 for i = 1, 10 do
387 local _continue_0 = false
388 repeat
389 repeat
390 local _cond_0 = false
391 local _continue_1 = false
392 repeat
393 do
394 local _with_0 = tb
395 if _with_0 ~= nil then
396 _with_0.a = 1
397 if _with_0.b then
398 _cond_0 = true
399 _continue_1 = true
400 break
401 end
402 do
403 if _with_0.c then
404 break
405 end
406 end
407 end
408 end
409 _cond_0 = true
410 _continue_1 = true
411 until true
412 if not _continue_1 then
413 break
414 end
415 until _cond_0
416 if 123 == x then
417 break
418 else
419 _continue_0 = true
420 break
421 end
422 if y then
423 _continue_0 = true
424 break
425 else
426 break
427 end
428 do
429 do
430 do
431 print(i)
432 _continue_0 = true
433 break
434 end
435 end
436 end
437 print("abc")
438 _continue_0 = true
439 until true
440 if not _continue_0 then
441 break
442 end
443 end
444end
diff --git a/spec/outputs/loops.lua b/spec/outputs/loops.lua
index eeea15f..79ef789 100644
--- a/spec/outputs/loops.lua
+++ b/spec/outputs/loops.lua
@@ -294,3 +294,44 @@ do
294 print(thing) 294 print(thing)
295 end 295 end
296end 296end
297do
298 for i = 1, 10 do
299 repeat
300 do
301 local _with_0 = tb
302 if _with_0 ~= nil then
303 _with_0.a = 1
304 if _with_0.b then
305 goto _continue_12
306 end
307 do
308 if _with_0.c then
309 break
310 end
311 end
312 end
313 end
314 ::_continue_12::
315 until true
316 if 123 == x then
317 break
318 else
319 goto _continue_11
320 end
321 if y then
322 goto _continue_11
323 else
324 break
325 end
326 do
327 do
328 do
329 print(i)
330 goto _continue_11
331 end
332 end
333 end
334 print("abc")
335 ::_continue_11::
336 end
337end