Check if a node is inside a call expression (to avoid double-counting as usage)
| 16 | |
| 17 | // Check if a node is inside a call expression (to avoid double-counting as usage) |
| 18 | static bool is_inside_call(TSNode node, const CBMLangSpec *spec) { |
| 19 | TSNode cur = ts_node_parent(node); |
| 20 | int depth = 0; |
| 21 | while (!ts_node_is_null(cur) && depth < MAX_PARENT_DEPTH) { |
| 22 | if (cbm_kind_in_set(cur, spec->call_node_types)) { |
| 23 | return true; |
| 24 | } |
| 25 | cur = ts_node_parent(cur); |
| 26 | depth++; |
| 27 | } |
| 28 | return false; |
| 29 | } |
| 30 | |
| 31 | // Check if a node is inside an import statement |
| 32 | static bool is_inside_import(TSNode node, const CBMLangSpec *spec) { |
no test coverage detected