From 4cebcbcfdf326c80725e757230f74af76055f574 Mon Sep 17 00:00:00 2001 From: Daniel Mathiot Date: Fri, 27 Aug 2021 12:09:35 +0200 Subject: [PATCH] (c) Fix return_statement in tree As the return statement in inside the body (aka compound_statement in TS), it was not being recognized. I added it and return_statement is now being retrieved. --- lua/neogen/configurations/c.lua | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lua/neogen/configurations/c.lua b/lua/neogen/configurations/c.lua index 35c6669..2407033 100644 --- a/lua/neogen/configurations/c.lua +++ b/lua/neogen/configurations/c.lua @@ -52,7 +52,7 @@ local c_function_extractor = function(node) { retrieve = "all", node_type = "identifier", - extract = true + extract = true, }, { @@ -62,7 +62,7 @@ local c_function_extractor = function(node) { retrieve = "all", node_type = "identifier", - extract = true + extract = true, }, { @@ -72,7 +72,7 @@ local c_function_extractor = function(node) { retrieve = "all", node_type = "identifier", - extract = true + extract = true, }, }, }, @@ -84,7 +84,13 @@ local c_function_extractor = function(node) }, }, }, - { retrieve = "first", node_type = "return_statement", extract = true }, + { + retrieve = "first", + node_type = "compound_statement", + subtree = { + { retrieve = "first", node_type = "return_statement", extract = true }, + }, + }, } local nodes = neogen.utilities.nodes:matching_nodes_from(node, tree)