From c4935826eea8df7a161b2b4ba9262dce66d9d366 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Mon, 16 May 2022 01:03:05 +0800 Subject: fix issue #102. fix `continue` statement locating issue. --- spec/inputs/loops.yue | 8 ++++++++ spec/outputs/loops.lua | 23 ++++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) (limited to 'spec') diff --git a/spec/inputs/loops.yue b/spec/inputs/loops.yue index 3191000..d03e661 100644 --- a/spec/inputs/loops.yue +++ b/spec/inputs/loops.yue @@ -109,6 +109,14 @@ repeat print a until a == 10 +x = 0 +repeat + x += 1 + y = x + continue if x < 5 + print y +until y == 10 + a = 3 until a == 0 a -= 1 diff --git a/spec/outputs/loops.lua b/spec/outputs/loops.lua index aa69840..bcd559c 100644 --- a/spec/outputs/loops.lua +++ b/spec/outputs/loops.lua @@ -187,6 +187,7 @@ for i = 1, 10 do end local a = 1 repeat + local _cond_0 local _continue_0 = false repeat a = a + 1 @@ -198,12 +199,32 @@ repeat break end print(a) + _cond_0 = a == 10 _continue_0 = true until true if not _continue_0 then break end -until a == 10 +until _cond_0 +x = 0 +repeat + local _cond_0 + local _continue_0 = false + repeat + x = x + 1 + y = x + if x < 5 then + _continue_0 = true + break + end + print(y) + _cond_0 = y == 10 + _continue_0 = true + until true + if not _continue_0 then + break + end +until _cond_0 a = 3 while not (a == 0) do a = a - 1 -- cgit v1.2.3-55-g6feb