Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No function display in code.db? #4

Open
perlawk opened this issue Mar 20, 2014 · 0 comments
Open

No function display in code.db? #4

perlawk opened this issue Mar 20, 2014 · 0 comments

Comments

@perlawk
Copy link

perlawk commented Mar 20, 2014

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant