The current line belongs to the view: every enclosing group sits in the branch the view keeps.
| 145 | // The current line belongs to the view: every enclosing group sits in the |
| 146 | // branch the view keeps. |
| 147 | static bool cpp_view_keeps(const cpp_nest_t *n, const int *branches, int view) { |
| 148 | if (n->depth == 0) { |
| 149 | return true; |
| 150 | } |
| 151 | const cpp_frame_t *top = &n->frames[n->depth - 1]; |
| 152 | int nb = branches[top->group]; |
| 153 | int kept = 0; |
| 154 | if (nb >= 2) { |
| 155 | kept = view < nb - 1 ? view : nb - 1; |
| 156 | } |
| 157 | return top->outer && top->branch == kept; |
| 158 | } |
| 159 | |
| 160 | char *cbm_cpp_branch_view(CBMArena *a, const char *src, int len, int view) { |
| 161 | int *branches = NULL; |
no outgoing calls
no test coverage detected