Go into `node`: its children are collected next. false when memory ran out. */
| 2286 | |
| 2287 | /* Go into `node`: its children are collected next. false when memory ran out. */ |
| 2288 | static bool cs_walk_push(cs_scan_t *s, cs_walk_stack_t *w, TSNode node, int owner) { |
| 2289 | if (ts_node_is_null(node)) { |
| 2290 | return true; |
| 2291 | } |
| 2292 | if (w->count >= w->cap) { |
| 2293 | int ncap = w->cap ? w->cap * PAIR_LEN : CS_HEADS_INIT; |
| 2294 | cs_walk_t *grown = (cs_walk_t *)cs_tmp_alloc(s, (size_t)ncap * sizeof(*grown)); |
| 2295 | if (!grown) { |
| 2296 | return false; |
| 2297 | } |
| 2298 | if (w->count > 0) { |
| 2299 | memcpy(grown, w->frames, (size_t)w->count * sizeof(*grown)); |
| 2300 | } |
| 2301 | w->frames = grown; |
| 2302 | w->cap = ncap; |
| 2303 | } |
| 2304 | w->frames[w->count++] = (cs_walk_t){.kids = cs_kids(node), .owner = owner}; |
| 2305 | return true; |
| 2306 | } |
| 2307 | |
| 2308 | /* One child `c` of a collected node: record what it declares and go into it |
| 2309 | * where declarations can sit. false when memory ran out. */ |
no test coverage detected