diff options
| author | ruki <[email protected]> | 2021-05-26 23:30:14 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-05-26 23:30:14 +0800 |
| commit | 7d1291b310e771c903922ebf4502372c7339c72e (patch) | |
| tree | 8b39b6d7003a0dde5a4718b5267117a39da6ae2f | |
| parent | 569a2d4f828654e042308c82b67b1108de4ef433 (diff) | |
remove some ifelse
| -rw-r--r-- | xmake/core/sandbox/modules/interpreter/os.lua | 4 | ||||
| -rw-r--r-- | xmake/modules/core/tools/cl.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/core/tools/cparser.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/core/tools/gcc.lua | 4 | ||||
| -rw-r--r-- | xmake/modules/core/tools/sdcc.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/core/tools/tcc.lua | 2 |
6 files changed, 6 insertions, 10 deletions
diff --git a/xmake/core/sandbox/modules/interpreter/os.lua b/xmake/core/sandbox/modules/interpreter/os.lua index c38c5de68..10c4b710c 100644 --- a/xmake/core/sandbox/modules/interpreter/os.lua +++ b/xmake/core/sandbox/modules/interpreter/os.lua @@ -66,12 +66,8 @@ end -- get the script directory function sandbox_os.scriptdir() - - -- get the current interpreter instance local instance = interpreter.instance() assert(instance) - - -- get the script directory return instance:scriptdir() end diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua index 46f488815..d95d58e5d 100644 --- a/xmake/modules/core/tools/cl.lua +++ b/xmake/modules/core/tools/cl.lua @@ -466,7 +466,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags, opt) end end if #lines > 0 then - local warnings = table.concat(table.slice(lines, 1, ifelse(#lines > 8, 8, #lines)), "\r\n") + local warnings = table.concat(table.slice(lines, 1, (#lines > 8 and 8 or #lines)), "\r\n") if progress.showing_without_scroll() then print("") end diff --git a/xmake/modules/core/tools/cparser.lua b/xmake/modules/core/tools/cparser.lua index ed3c83a78..a155b7fa2 100644 --- a/xmake/modules/core/tools/cparser.lua +++ b/xmake/modules/core/tools/cparser.lua @@ -191,7 +191,7 @@ function _compile1(self, sourcefile, objectfile, dependinfo, flags) -- get 16 lines of errors if start > 0 or not option.get("verbose") then if start == 0 then start = 1 end - errors = table.concat(table.slice(lines, start, start + ifelse(#lines - start > 16, 16, #lines - start)), "\n") + errors = table.concat(table.slice(lines, start, start + ((#lines - start > 16) and 16 or (#lines - start))), "\n") end -- raise compiling errors diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua index f2bb70f81..89b732ec9 100644 --- a/xmake/modules/core/tools/gcc.lua +++ b/xmake/modules/core/tools/gcc.lua @@ -473,7 +473,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags) -- get 16 lines of errors if start > 0 then - lines = table.slice(lines, start, start + ifelse(#lines - start > 16, 16, #lines - start)) + lines = table.slice(lines, start, start + ((#lines - start > 16) and 16 or (#lines - start))) end end @@ -488,7 +488,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags) if ok and errdata and #errdata > 0 and (option.get("diagnosis") or option.get("warning") or global.get("build_warning")) then local lines = errdata:split('\n', {plain = true}) if #lines > 0 then - local warnings = table.concat(table.slice(lines, 1, ifelse(#lines > 8, 8, #lines)), "\n") + local warnings = table.concat(table.slice(lines, 1, (#lines > 8 and 8 or #lines)), "\n") if progress.showing_without_scroll() then print("") end diff --git a/xmake/modules/core/tools/sdcc.lua b/xmake/modules/core/tools/sdcc.lua index 36445e79f..00e081384 100644 --- a/xmake/modules/core/tools/sdcc.lua +++ b/xmake/modules/core/tools/sdcc.lua @@ -209,7 +209,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags) -- get 16 lines of errors if start > 0 or not option.get("verbose") then if start == 0 then start = 1 end - errors = table.concat(table.slice(lines, start, start + ifelse(#lines - start > 16, 16, #lines - start)), "\n") + errors = table.concat(table.slice(lines, start, start + ((#lines - start > 16) and 16 or (#lines - start))), "\n") end -- raise compiling errors diff --git a/xmake/modules/core/tools/tcc.lua b/xmake/modules/core/tools/tcc.lua index d5400c994..7d306997f 100644 --- a/xmake/modules/core/tools/tcc.lua +++ b/xmake/modules/core/tools/tcc.lua @@ -179,7 +179,7 @@ function _compile1(self, sourcefile, objectfile, dependinfo, flags) -- get 16 lines of errors if start > 0 or not option.get("verbose") then if start == 0 then start = 1 end - errors = table.concat(table.slice(lines, start, start + ifelse(#lines - start > 16, 16, #lines - start)), "\n") + errors = table.concat(table.slice(lines, start, start + ((#lines - start > 16) and 16 or (#lines - start))), "\n") end -- raise compiling errors |
