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

Function sh_if

src/pipeline/pass_shell.c:2611–2645  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2609}
2610
2611static void sh_if(sh_t *s, TSNode n) {
2612 sh_touch_t t = {0};
2613 sh_mark_t m = {0};
2614 bool open = false;
2615 for (uint32_t i = 0; i < ts_node_child_count(n); i++) {
2616 TSNode c = ts_node_child(n, i);
2617 if (!ts_node_is_named(c) || sh_type(c, "comment")) {
2618 continue;
2619 }
2620 const char *field = ts_node_field_name_for_child(n, i);
2621 if (sh_eq(field, "condition")) {
2622 sh_walk(s, c);
2623 continue;
2624 }
2625 if (sh_type(c, "elif_clause") || sh_type(c, "else_clause")) {
2626 if (open) {
2627 sh_clause_end(s, m, &t);
2628 open = false;
2629 }
2630 sh_mark_t mc = sh_mark(s);
2631 sh_walk_children(s, c);
2632 sh_clause_end(s, mc, &t);
2633 continue;
2634 }
2635 if (!open) {
2636 m = sh_mark(s);
2637 open = true;
2638 }
2639 sh_walk(s, c);
2640 }
2641 if (open) {
2642 sh_clause_end(s, m, &t);
2643 }
2644 sh_group_end(s, &t);
2645}
2646
2647static void sh_case(sh_t *s, TSNode n) {
2648 TSNode value = ts_node_child_by_field_name(n, TS_FIELD("value"));

Callers 1

sh_walkFunction · 0.85

Calls 7

sh_typeFunction · 0.85
sh_eqFunction · 0.85
sh_walkFunction · 0.85
sh_clause_endFunction · 0.85
sh_markFunction · 0.85
sh_walk_childrenFunction · 0.85
sh_group_endFunction · 0.85

Tested by

no test coverage detected