summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
authorfesily <fesil@foxmail.com>2023-05-22 16:12:22 +0800
committerfesily <fesil@foxmail.com>2023-05-22 16:12:22 +0800
commit17f3577d70c4d11ba7e09bad0e460c4538f14970 (patch)
treed7609554230126cdf38eaeae01d1e7d3d878b82a /script
parent570bd8f0fe1babc404db45cfdb7a318c31010364 (diff)
downloadlua-language-server-17f3577d70c4d11ba7e09bad0e460c4538f14970.zip
remove jit
Diffstat (limited to 'script')
-rw-r--r--script/plugins/ffi/c-parser/cpp.lua29
1 files changed, 8 insertions, 21 deletions
diff --git a/script/plugins/ffi/c-parser/cpp.lua b/script/plugins/ffi/c-parser/cpp.lua
index 989bca66..eaa34330 100644
--- a/script/plugins/ffi/c-parser/cpp.lua
+++ b/script/plugins/ffi/c-parser/cpp.lua
@@ -1,5 +1,3 @@
----@diagnostic disable: undefined-global, assign-type-mismatch
-
local cpp = {}
local typed = require("plugins.ffi.c-parser.typed")
@@ -7,24 +5,11 @@ local c99 = require("plugins.ffi.c-parser.c99")
local SEP = package.config:sub(1,1)
-local shl, shr
-if jit then
- shl = function(a, b)
- return bit.lshift(a, b)
- end
- shr = function(a, b)
- return bit.rshift(a, b)
- end
-else
- shl, shr = load([[
- local function shl(a, b)
- return a << b
- end
- local function shr(a, b)
- return a >> b
- end
- return shl, shr
- ]])()
+local function shl(a, b)
+ return a << b
+end
+local function shr(a, b)
+ return a >> b
end
local function debug(...) end
@@ -624,6 +609,7 @@ cpp.parse_file = typed("string, FILE*?, Ctx? -> Ctx?, string?", function(filenam
ctx = {
incdirs = cpp_include_paths(),
defines = gcc_default_defines(),
+ ---@type any[]
ifmode = { true },
output = {},
current_dir = {}
@@ -786,7 +772,7 @@ cpp.parse_context = typed("string, FILE*?, Ctx? -> Ctx?, string?", function(cont
for cur, lineitem in ipairs(linelist) do
local line = lineitem.line
local tk = lineitem.tk
- debug(filename, cur, ifmode[#ifmode], #ifmode, line)
+ debug(cur, ifmode[#ifmode], #ifmode, line)
if #ifmode == 1 and (tk.directive == "elif" or tk.directive == "else" or tk.directive == "endif") then
return nil, "unexpected directive " .. tk.directive
@@ -813,6 +799,7 @@ cpp.parse_context = typed("string, FILE*?, Ctx? -> Ctx?, string?", function(cont
elseif tk.directive == "if" then
table.insert(ifmode, run_expression(ctx, tk.exp))
elseif tk.directive == "elif" then
+---@diagnostic disable-next-line: assign-type-mismatch
ifmode[#ifmode] = "skip"
elseif tk.directive == "else" then
ifmode[#ifmode] = not ifmode[#ifmode]