Check if a node is inside an import statement
| 30 | |
| 31 | // Check if a node is inside an import statement |
| 32 | static bool is_inside_import(TSNode node, const CBMLangSpec *spec) { |
| 33 | if (!spec->import_node_types || !spec->import_node_types[0]) { |
| 34 | return false; |
| 35 | } |
| 36 | TSNode cur = ts_node_parent(node); |
| 37 | int depth = 0; |
| 38 | while (!ts_node_is_null(cur) && depth < MAX_PARENT_DEPTH) { |
| 39 | if (cbm_kind_in_set(cur, spec->import_node_types)) { |
| 40 | return true; |
| 41 | } |
| 42 | cur = ts_node_parent(cur); |
| 43 | depth++; |
| 44 | } |
| 45 | return false; |
| 46 | } |
| 47 | |
| 48 | // Is this an identifier-like node that represents a reference? |
| 49 | static bool is_reference_node(TSNode node, CBMLanguage lang) { |
no test coverage detected