aerial.nvim/tests/treesitter/c_test.c
Steven Arcangeli e8366e30b4 fix(ts)(c/cpp): detect functions that return pointers (fix #25)
Side note: this unfortunately moves the symbol location forward in the
line to where the name starts, where before it was at the beginning of
the return type. Every time you add a pointer to the return type (e.g.
int* fn() or int** fn()) it creates a new treesitter wrapper node of
"pointer_declaration". Unfortunately there does not seem to currently be
a way to write a query for function_definition -> <any number for
children> -> function_declaration. Because of that, we must either
explicitly query for each level of pointer indirection, or just query
directly for the function_declaration. I have opted for the latter
because it is cleaner, but it has the side effect of changing the symbol
location slightly.
2021-11-30 11:12:39 -08:00

19 lines
228 B
C

#define FOO
#define BAR
void fn_1() FOO BAR {}
void *fn_2() FOO BAR { return 0; }
void fn_3() {}
void *fn_4() { return 0; }
void **fn_5() { return 0; }
typedef enum {
kVal,
} kEnum;
typedef struct {
int field;
} St_1;