Skip to content

No function display in code.db? #4

@perlawk

Description

@perlawk

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions