Add test for pointer return value

This commit is contained in:
David Granström
2021-10-01 13:30:40 +02:00
parent 7320b90119
commit c0cd1bc91f

View File

@@ -37,6 +37,11 @@ local c_function_extractor = function(node)
node_type = "primitive_type", node_type = "primitive_type",
extract = true, extract = true,
}, },
{
retrieve = "first",
node_type = "pointer_declarator",
extract = true,
},
c_params, c_params,
} }
@@ -53,9 +58,11 @@ local c_function_extractor = function(node)
if res.return_statement then if res.return_statement then
-- function implementation -- function implementation
return res.return_statement return res.return_statement
elseif res.function_declarator and res.primitive_type and res.primitive_type[1] ~= "void" then elseif res.function_declarator and res.primitive_type then
-- function prototype if res.primitive_type[1] ~= "void" or res.pointer_declarator then
return res.primitive_type -- function prototype
return res.primitive_type
end
end end
-- not found -- not found
return nil return nil