From 81271283d1311340daf133ec8ba20a15ced401ad Mon Sep 17 00:00:00 2001 From: Li Jin Date: Mon, 24 Jul 2023 18:14:28 +0800 Subject: fix format separator. --- src/3rdParty/LuaMinify.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/3rdParty/LuaMinify.h b/src/3rdParty/LuaMinify.h index 5512f5b..05bb0b8 100644 --- a/src/3rdParty/LuaMinify.h +++ b/src/3rdParty/LuaMinify.h @@ -2089,16 +2089,23 @@ local function FormatYue(ast, lineMap) local formatStatlist, formatExpr local function joinStatementsSafe(out, b, sep) + if #out < 1 then + return '' + end local aa = '' + local spaceSep = b:sub(1,1) == ' ' for i = #out, 1, -1 do local a = out[i] + if a:sub(-1,-1) == ' ' then + spaceSep = true + end aa = a:match("([^%s])%s*$") if aa then break end end sep = sep or ' ' - if (out[#out] or ''):sub(-1,-1) == ' ' then + if spaceSep then sep = '' end local bb = b:match("^%s*([^%s])") -- cgit v1.2.3-55-g6feb