From a9fe6a5c4c17cf7e8305c1d614939ce510fb1103 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Mon, 16 May 2022 09:45:04 +0800 Subject: fix issue #97 by line decorator. --- spec/inputs/attrib.yue | 8 ++++++++ spec/outputs/attrib.lua | 39 +++++++++++++++++++++++++++++++++++++++ spec/outputs/loops.lua | 4 ++-- 3 files changed, 49 insertions(+), 2 deletions(-) (limited to 'spec') diff --git a/spec/inputs/attrib.yue b/spec/inputs/attrib.yue index 7e9a42c..500ef0f 100644 --- a/spec/inputs/attrib.yue +++ b/spec/inputs/attrib.yue @@ -14,6 +14,14 @@ do close f = with io.open "file.txt" \write "Hello" +do + const a = 1 if true + close b = (if x then 1) unless false + const c = (switch x + when "abc" then 998) if true + close d = + :value if a ?? b + macro defer = (item)-> "close _ = #{item}" macro defer_f = (func)-> "close _ = setmetatable {},__close:#{func}" diff --git a/spec/outputs/attrib.lua b/spec/outputs/attrib.lua index d9ac3f2..aed549d 100644 --- a/spec/outputs/attrib.lua +++ b/spec/outputs/attrib.lua @@ -24,6 +24,45 @@ do return _with_0 end)() end +do + local a = (function() + if true then + return 1 + end + end)() + local b = (function() + if not false then + return ((function() + if x then + return 1 + end + end)()) + end + end)() + local c = (function() + if true then + return ((function() + local _exp_0 = x + if "abc" == _exp_0 then + return 998 + end + end)()) + end + end)() + local d = (function() + if (function() + if a ~= nil then + return a + else + return b + end + end)() then + return { + value = value + } + end + end)() +end do local _ = (function() local _with_0 = io.open("file.txt") diff --git a/spec/outputs/loops.lua b/spec/outputs/loops.lua index bcd559c..7f87b2d 100644 --- a/spec/outputs/loops.lua +++ b/spec/outputs/loops.lua @@ -187,7 +187,7 @@ for i = 1, 10 do end local a = 1 repeat - local _cond_0 + local _cond_0 = false local _continue_0 = false repeat a = a + 1 @@ -208,7 +208,7 @@ repeat until _cond_0 x = 0 repeat - local _cond_0 + local _cond_0 = false local _continue_0 = false repeat x = x + 1 -- cgit v1.2.3-55-g6feb