diff options
author | Li Jin <dragon-fly@qq.com> | 2023-07-24 18:14:28 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2023-07-24 18:14:28 +0800 |
commit | 81271283d1311340daf133ec8ba20a15ced401ad (patch) | |
tree | f5851b2b2b22b58ebc33ec4d0e37473f39c460f3 | |
parent | c03b88e6210818e604d7c755fe8f54fe53696ee1 (diff) | |
download | yuescript-81271283d1311340daf133ec8ba20a15ced401ad.tar.gz yuescript-81271283d1311340daf133ec8ba20a15ced401ad.tar.bz2 yuescript-81271283d1311340daf133ec8ba20a15ced401ad.zip |
fix format separator.
-rw-r--r-- | src/3rdParty/LuaMinify.h | 9 |
1 files changed, 8 insertions, 1 deletions
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) | |||
2089 | local formatStatlist, formatExpr | 2089 | local formatStatlist, formatExpr |
2090 | 2090 | ||
2091 | local function joinStatementsSafe(out, b, sep) | 2091 | local function joinStatementsSafe(out, b, sep) |
2092 | if #out < 1 then | ||
2093 | return '' | ||
2094 | end | ||
2092 | local aa = '' | 2095 | local aa = '' |
2096 | local spaceSep = b:sub(1,1) == ' ' | ||
2093 | for i = #out, 1, -1 do | 2097 | for i = #out, 1, -1 do |
2094 | local a = out[i] | 2098 | local a = out[i] |
2099 | if a:sub(-1,-1) == ' ' then | ||
2100 | spaceSep = true | ||
2101 | end | ||
2095 | aa = a:match("([^%s])%s*$") | 2102 | aa = a:match("([^%s])%s*$") |
2096 | if aa then | 2103 | if aa then |
2097 | break | 2104 | break |
2098 | end | 2105 | end |
2099 | end | 2106 | end |
2100 | sep = sep or ' ' | 2107 | sep = sep or ' ' |
2101 | if (out[#out] or ''):sub(-1,-1) == ' ' then | 2108 | if spaceSep then |
2102 | sep = '' | 2109 | sep = '' |
2103 | end | 2110 | end |
2104 | local bb = b:match("^%s*([^%s])") | 2111 | local bb = b:match("^%s*([^%s])") |