Walk a block_sequence node and emit one CBMImport per block_sequence_item scalar child, using key_name as the local_name.
| 78 | // Walk a block_sequence node and emit one CBMImport per block_sequence_item |
| 79 | // scalar child, using key_name as the local_name. |
| 80 | static void emit_kustomize_sequence(CBMExtractCtx *ctx, TSNode seq_node, const char *key_name) { |
| 81 | CBMArena *a = ctx->arena; |
| 82 | uint32_t n = ts_node_child_count(seq_node); |
| 83 | for (uint32_t i = 0; i < n; i++) { |
| 84 | TSNode item = ts_node_child(seq_node, i); |
| 85 | if (strcmp(ts_node_type(item), "block_sequence_item") != 0) { |
| 86 | continue; |
| 87 | } |
| 88 | // block_sequence_item has one named child: the value |
| 89 | uint32_t ic = ts_node_child_count(item); |
| 90 | for (uint32_t j = 0; j < ic; j++) { |
| 91 | TSNode val = ts_node_child(item, j); |
| 92 | const char *scalar = get_scalar_text(a, val, ctx->source); |
| 93 | if (!scalar) { |
| 94 | continue; |
| 95 | } |
| 96 | CBMImport imp = { |
| 97 | .local_name = cbm_arena_strdup(a, key_name), |
| 98 | .module_path = cbm_arena_strdup(a, scalar), |
| 99 | }; |
| 100 | cbm_imports_push(&ctx->result->imports, a, imp); |
| 101 | } |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | // Unwrap a YAML node through optional block_node wrapper to get block_mapping. |
| 106 | // Returns null node if not a block_mapping. |
no test coverage detected