-
Notifications
You must be signed in to change notification settings - Fork 15
Description
In the example: cindex.lua, when a function header like:
int five(void);
The code.db will not show anything about it.
Here is my patch for the suspected bug:
function processFunction(func)
DBG('=>', func:displayName(), getExtent(func:location()))
-- process argument
local argTable = {}
local args = func:arguments()
-- suspected bugs, my patch
if #args == 0 then
argTable[1] = { name = "", type = "Void", const = false, default=""}
else
for i, arg in ipairs(args) do
argTable[i] = processArgument(i, arg)
end
end
local result = translateType(func, func:resultType())
return {
name = func:name(),
signature = func:displayName(),
args = argTable,
result = result,
}
end
local functions = findChildrenByType(tu:cursor(), "FunctionDecl")
local FUNC = {}
for , func in ipairs(functions) do
local name = func:name()
local dname = func:displayName()
if not FUNC[dname] then
DBG(, name, dname)
-- suspected bugs, my patch
if #func:arguments() == 0 then
FUNC[dname] = processFunction(func)
else
for i,arg in ipairs(func:arguments()) do
DBG('', i, arg:name(), translateType(arg, arg:type()))
FUNC[dname] = processFunction(func)
end
end
end
end