Push nested class nodes from a class body container onto the defs stack. Iteratively walks into wrapper nodes (field_declaration, template_declaration).
| 5746 | // Push nested class nodes from a class body container onto the defs stack. |
| 5747 | // Iteratively walks into wrapper nodes (field_declaration, template_declaration). |
| 5748 | static void push_nested_class_nodes(TSNode body, const CBMLangSpec *spec, wd_stack_t *s, |
| 5749 | const char *enclosing_qn, CBMArena *arena) { |
| 5750 | TSNodeStack nc_stack; |
| 5751 | ts_nstack_init(&nc_stack, arena, NESTED_CLASS_STACK_CAP); |
| 5752 | ts_nstack_push(&nc_stack, arena, body); |
| 5753 | |
| 5754 | while (nc_stack.count > 0) { |
| 5755 | TSNode cur = ts_nstack_pop(&nc_stack); |
| 5756 | uint32_t nc = ts_node_child_count(cur); |
| 5757 | /* Linear child access for wide class bodies (see wd_collect_children). */ |
| 5758 | TSNode *kids = wd_collect_children(cur, nc); |
| 5759 | for (int i = (int)nc - SKIP_CHAR; i >= 0; i--) { |
| 5760 | TSNode child = kids ? kids[i] : ts_node_child(cur, (uint32_t)i); |
| 5761 | if (cbm_kind_in_set(child, spec->class_node_types)) { |
| 5762 | wd_push(s, child, enclosing_qn); |
| 5763 | } else { |
| 5764 | const char *ck = ts_node_type(child); |
| 5765 | if (strcmp(ck, "field_declaration") == 0 || |
| 5766 | strcmp(ck, "template_declaration") == 0 || strcmp(ck, "declaration") == 0) { |
| 5767 | ts_nstack_push(&nc_stack, arena, child); |
| 5768 | } |
| 5769 | } |
| 5770 | } |
| 5771 | free(kids); |
| 5772 | } |
| 5773 | } |
| 5774 | |
| 5775 | // Check if a C++/CUDA template_declaration wraps a class/struct/union (not a function). |
| 5776 | static bool is_template_class_node(TSNode node, CBMLanguage lang) { |
no test coverage detected