From 72a82df7f294ee8e1f095f07fc836127c27c791c Mon Sep 17 00:00:00 2001 From: danymat Date: Fri, 7 Jan 2022 18:00:10 +0100 Subject: [PATCH] fix(c/cpp) Do not show multiple returns (#32) --- lua/neogen/configurations/c.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lua/neogen/configurations/c.lua b/lua/neogen/configurations/c.lua index b967d3b..e995e4a 100644 --- a/lua/neogen/configurations/c.lua +++ b/lua/neogen/configurations/c.lua @@ -73,16 +73,19 @@ local c_function_extractor = function(node) res = vim.tbl_deep_extend("keep", res, subres) end + --- Checks if we have a return statement. + --- If so, return { true } as we don't need to properly know the content of the node for the template + --- @return table? local has_return_statement = function() if res.return_statement then -- function implementation return res.return_statement elseif res.function_declarator and (res.primitive_type or res.type_identifier) then if res.type_identifier then - return res.type_identifier + return { true } elseif res.primitive_type[1] ~= "void" or res.pointer_declarator then -- function prototype - return res.primitive_type + return { true } end end -- not found