MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / ts_walk_namespaces

Function ts_walk_namespaces

internal/cbm/doclink_ts.c:644–667  ·  view source on GitHub ↗

The namespaces declared in a namespace body, exported or not. */

Source from the content-addressed store, hash-verified

642
643/* The namespaces declared in a namespace body, exported or not. */
644static void ts_walk_namespaces(ts_walk_t *w, TSNode body, const char *prefix, int depth) {
645 TSTreeCursor cur = ts_tree_cursor_new(body);
646 for (bool more = ts_tree_cursor_goto_first_child(&cur); more;
647 more = ts_tree_cursor_goto_next_sibling(&cur)) {
648 TSNode c = ts_tree_cursor_current_node(&cur);
649 if (!ts_node_is_named(c)) {
650 continue;
651 }
652 if (ts_kind(c, "export_statement")) {
653 TSNode d = ts_node_child_by_field_name(c, TS_FIELD("declaration"));
654 if (!ts_node_is_null(d)) {
655 ts_walk_decl(w, d, true, false, prefix, depth);
656 }
657 } else if (ts_kind(c, "expression_statement")) {
658 uint32_t ec = ts_node_named_child_count(c);
659 for (uint32_t k = 0; k < ec; k++) {
660 ts_walk_decl(w, ts_node_named_child(c, k), false, false, prefix, depth);
661 }
662 } else {
663 ts_walk_decl(w, c, false, false, prefix, depth);
664 }
665 }
666 ts_tree_cursor_delete(&cur);
667}
668
669static bool ts_has_default(TSNode stmt) {
670 uint32_t nc = ts_node_child_count(stmt);

Callers 1

ts_walk_declFunction · 0.85

Calls 2

ts_kindFunction · 0.85
ts_walk_declFunction · 0.85

Tested by

no test coverage detected